protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Cursor c = (Cursor) mAdapter.getItem(position);
String a = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
String b = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
if (names != null)
{
if(numbers.contains(b))
{
names = names.replace(a+";", "");
numbers = numbers.replace(b+";", "");
v.setBackgroundResource(R.drawable.background);
}
else{
names = names + a + ";";
numbers = numbers + b + ";";
v.setBackgroundResource(R.drawable.background_sel);
}
}
else
{
names = a+";";
numbers = b+";";
v.setBackgroundResource(R.drawable.background_sel);
}
}
when i select an item random other items background also gets changed although they are not added to the array names and numbers.
i need only the background of the selected item tochange... is there a way to do this without creating my own listadapter ? ?