I have an Adapter
with ViewHolder
. Let's say I want to set data only once to the ViewHoler
inside the getView()
method, what's actually happened is, its set the data every time I'm scrolling the view.
How can I check if the ViewHolder
was already init or not?
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
Deal deal = dealsArr.get(position);
holder.textView.setText(deal.getPrice);
// Here is my issue. how can I do it only once?
changePrice(deal, true);
}