I have ListView
filling It with an Adapter
, I scroll in the ListView
to view the next items, when I return to the items on the top of the list, I found that the data at the top is different than the first time ListView
is initialized. I fill list using Api called From Server.
Asked
Active
Viewed 43 times
0

Matthew Shearer
- 2,715
- 3
- 23
- 32

AhmedAdel
- 15
- 9
-
the problem is in getview method. post here code to identify problem – Hitesh Gehlot Apr 06 '17 at 09:38
-
Thanks alot " Hitesh Gehlot " your advice help me to solve the problem – AhmedAdel Apr 06 '17 at 10:48
3 Answers
0
it's may help full to you.
@Override public int getViewTypeCount() {
return getCount();
}
@Override public int getItemViewType(int position) {
return position;
}
0
if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.layout_row_myappointments, null);
holder = new ViewHolder();
//your fields like below:
holder.userName = (TextView) convertView.findViewById(R.id.username);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
Try to change code like this in your getView()

Kuldeep Kulkarni
- 796
- 5
- 20
0
Have you used ViewHolder to hold view in its position? If not then use it.
Here is the useful link:
https://stackoverflow.com/a/21501329/7391385
If you want full demo then try this:

Community
- 1
- 1

Siddharth Sheth
- 207
- 2
- 6