This is how I see my screen the when the page loads. But when I start scrolling through the list, all my records start to change and it becomes really weird. I really don't know why, any suggestions?
This is the screen after I scroll through my ListView
up and down.
Adapter:
private class TechnicalDocumentationAdapter extends
ArrayAdapter<TechnicalDocumentation> {
private ArrayList<TechnicalDocumentation> items;
public TechnicalDocumentationAdapter(Context context,
int textViewResourceId, ArrayList<TechnicalDocumentation> items) {
super(context, textViewResourceId, items);
this.items = items;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.technicaldocumentationrow, null);
}
TechnicalDocumentation technicalDocumentation = items.get(position);
if (technicalDocumentation != null) {
TextView tt = (TextView) v.findViewById(R.id.TDRdate);
TextView bt = (TextView) v.findViewById(R.id.TDRobjectTypeCode);
TextView ct = (TextView) v
.findViewById(R.id.TDRperformedAction);
TextView at = (TextView) v.findViewById(R.id.TDRobjectName);
tt.setText(tt.getText() + "\n " + technicalDocumentation.date);
bt.setText(bt.getText() + "\n "
+ technicalDocumentation.objectTypeCode);
ct.setText(ct.getText() + "\n "
+ technicalDocumentation.performedAction);
at.setText(at.getText() + "\n "
+ technicalDocumentation.objectName);
}
return v;
}
}
Something that worked for me was this:
But this solution made the navigation much slower.
EDIT
This was not the correct solution.
The way to go was to clean all views before assigning the new values.
Android ListView recycles views. At the moment the problem is that your adapter always appends new data to the TextViews. Now every time a new row is shown, you are appending the data from the new row to the old data.
To solve this, you should clear the TextViews from the old data if you are using the convertView parameter.