I am using multi choice mode to select the items in the listview with filter. After searching through the list view when I select an item it highlights a different position instead of the original position of the item in the list view.
for example:
1. With filter, I’ve selected the following item:
2. On the main list view with no filter, it does not highlight the selected item, but the wrong one:
In the below code of my Main Activity, how can I achieve what I’m looking for:
for example:
1. With filter, I’ve selected the following item:
2. On the main list view with no filter, it does not highlight the selected item, but the wrong one:
In the below code of my Main Activity, how can I achieve what I’m looking for:
Code:
ListView [B]list[/B];
[B]apps[/B].setChoiceMode([B]apps[/B].[B][I]CHOICE_MODE_MULTIPLE_MODAL[/I][/B]);
[B]apps[/B].setMultiChoiceModeListener([B]new [/B]AbsListView.MultiChoiceModeListener() {
@Override
[B]public void [/B]onItemCheckedStateChanged(ActionMode mode, [B]final int [/B]position, [B]long [/B]id, [B]boolean [/B]checked) {
[I]//If the item is selected in the listview list
[/I][B]if [/B]([B]list[/B].isItemChecked(position)) {
Toast.[I]makeText[/I](getApplicationContext(), [B]"CHECKED" [/B], Toast.[B][I]LENGTH_LONG[/I][/B]).show();
//how can I maintain the original position of the filtered item????[I]
[/I]
}
//[I]If the selection is removed for the item in the listview list[/I]
[B]else [/B]{
Toast.[I]makeText[/I](getApplicationContext(), [B]"UNCHECKED" [/B], Toast.[B][I]LENGTH_LONG[/I][/B]).show();
}