I have a custom cursor adapter that retrieves the date from the database and populates the list, and in my onlistItemClick listener I show the view attached to this line and then hide this view by clicking it again,
everything works fine, but I have two problems ,
1) - I have 10 lines, it shows 10, but when I record positions, it gives me only those positions that are suitable for the screen.
2) - when I click on a line, a view appears attached to this line, but when I scroll down, I find that another point of view is visible on the screen,
here is my adapter
public class CustomCursorAdapter extends CursorAdapter {
private LayoutInflater mInflater;
public CustomCursorAdapter(Context context, Cursor cursor, int flags) {
super(context, cursor, flags);
mInflater = LayoutInflater.from(context);
}
@Override
public void bindView(View view, final Context context, final Cursor cursor) {
TextView textView = (TextView) view.findViewById(R.id.txtview);
textView.setText(cursor.getString(cursor.getColumnIndex("text")));
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View rowView = mInflater.inflate(R.layout.list_layout, parent, false);
if(cursor.getPosition()%2 != 0)
{
rowView.setBackgroundResource(R.drawable.list_selector);
}
return rowView;
}
}
, , .
, .