Android : How to change background colour in adapter list view in android?

on Saturday, July 5, 2014


In adapter listview first time click on listview of row, it is not working but second time it is working, the row background color is changed. Please suggest me how is working fine.



productList.setOnItemClickListener(new OnItemClickListener() {

//mOnDoubleTapListener = listener;

@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {

Log.d("Row", "Row:= "+row);
Log.d("View", "View:= "+view);

if(row != null) {
row.setBackgroundColor(Color.WHITE);
}

view.setBackgroundColor(Color.WHITE);
view.setBackgroundColor(Color.CYAN);

row = view;
}});

0 comments:

Post a Comment