How to change the background color onlongclick of list item in android, now iam getting the position of the list item onlongclick by using below code.
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int pos, long id) {
// TODO Auto-generated method stub
Log.v("long clicked","pos: " + pos);
return true;
}
});
Any help will be appriciated,, thank you
Try this,
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View view,
int arg2, long arg3) {
view.setBackgroundColor(Color.parseColor("#222222"));
Log.v("Long Click", "Working");
return false;
}
});