I have tried quite a few suggestions and am still coming up short.
I have a Listview with 100+ Items.
When I select a single Item I want the Background Color to change so as to visually indicate Selection.
I have set up the Item Selector for the items to show State-specific Colors
These settings are
When I do a programmatic 'Touch' - the Listview scrolls to the intended item (as intended), but the Background Color does not change
When the programmatic 'Touch' is done (via Voice Recognition) the following is currently being done:
1. The ListView data source is searched for a matching item and if found, the ListView's Item ID is determined.
2. With a matchingLotID the following commands are executed:
4. That again issues the setSelected() setPressed() commands.
When in development Debug more I can watch the setOnItemClick() method execute for a physical Touch - again = everything works fine. The Background Color changes as intended
Then when I watch the same code executed for the programmatic 'Touch' the Background Colors does NOT change.
I am baffled (mostly because I am an Android 'greenhorn')
What am I missing?
Thanks
DhugalMac
I have a Listview with 100+ Items.
When I select a single Item I want the Background Color to change so as to visually indicate Selection.
I have set up the Item Selector for the items to show State-specific Colors
These settings are
<item android:state_selected="false" android:drawable="@color/orange_500" />
<item android:state_pressed="false" android:drawable="@color/blue_500" />
<item android:state_focused="false" android:drawable="@color/green_500" />
<item android:state_active="false" android:drawable="@color/red_600" />
<item android:state_checked="false" android:drawable="@color/purple_500" />
When I do a physical Touch - things work as intended. <item android:state_pressed="false" android:drawable="@color/blue_500" />
<item android:state_focused="false" android:drawable="@color/green_500" />
<item android:state_active="false" android:drawable="@color/red_600" />
<item android:state_checked="false" android:drawable="@color/purple_500" />
When I do a programmatic 'Touch' - the Listview scrolls to the intended item (as intended), but the Background Color does not change
When the programmatic 'Touch' is done (via Voice Recognition) the following is currently being done:
1. The ListView data source is searched for a matching item and if found, the ListView's Item ID is determined.
2. With a matchingLotID the following commands are executed:
ListView.setItemChecked(matchingLotID,true);
Listview.setSelection(matchingLotID);
Listview.setPressed(true);
Listview.performItemClick( the associated parameters here );
3. Now that launches the associated setOnItemClickListener() method which in turn launches the setOnItemClick() method Listview.setSelection(matchingLotID);
Listview.setPressed(true);
Listview.performItemClick( the associated parameters here );
4. That again issues the setSelected() setPressed() commands.
When in development Debug more I can watch the setOnItemClick() method execute for a physical Touch - again = everything works fine. The Background Color changes as intended
Then when I watch the same code executed for the programmatic 'Touch' the Background Colors does NOT change.
I am baffled (mostly because I am an Android 'greenhorn')
What am I missing?
Thanks
DhugalMac