7 Best Astrology Apps for Accurate Horoscopes
Millions of people across the globe turn to astrology for guidance in love, career, health, and personal growth. A survey by Pew Research Center found that 29% of Americans believe […]
The getView() method of the class extending the BaseAdapter holds the state of the currently displayed view which is invalidated when scrolling the listview. So, in order to avoid this problem, proceed in the following manner.
• Create a nested class within the class (class which is extending BaseAdapter Class), namely, Viewholder.
• Declare all the views of an individual list item in this Viewholder Class.
• Create an object of this Viewholder class in the getView() method and initialize all the views declared in the Viewholder class using this object.
Example :
Activity activity;
publicclassViewHolder{
TextViewtextview;
CheckBoxcheckbox;
}
public View getView(finalint position, View convertView, ViewGroup parent)
{
View vi=convertView;
LayoutInflaterinflater = activity.getLayoutInflater();
vi = inflater.inflate (R.layout.listitem, null);
ViewHolder item=newViewHolder();
item.textview = (TextView)vi.findViewById(R.id.textview1);
item.checkbox = (CheckBox)vi.findViewById(R.id.checkbox1);
vi.setTag(item);
return vi;
}
Implement this and check the state of the checkbox while scrolling the listview.
Feb 20th, 2025
Millions of people across the globe turn to astrology for guidance in love, career, health, and personal growth. A survey by Pew Research Center found that 29% of Americans believe […]
Feb 11th, 2025
Remember when your parents warned you never to get into a car with a stranger? Fast forward to today, and getting into a stranger’s car has become a global business […]
Feb 6th, 2025
In today’s digital age, convenience is king, and online gift delivery services are thriving. With the global online gift market expected to grow significantly, now is the perfect time to […]