How do I do when I "click" the "Back" icon on Android and unselect all items in the ListView instead of quitting Activity?
How do I do when I "click" the "Back" icon on Android and unselect all items in the ListView instead of quitting Activity?
Click the back icon, I guess it's the default Android OS back, correct?
To do this, you must do the override of the onBackPressed role within the activity you want the default behavior to change added of more things).
Then, within the onBackPressed function, you take the selection of all your items through your adapter used to populate ListView.
OBS Important
It is not healthy, nor encouraged, and even less recommended that standard OS events be overwritten to alter their default behavior.
People who use android are accustomed to clicking back to perform certain action, changing this can cause discomfort in the users of your APP (games are an exception).
Just a hint of mobile development standards.
I hope I have helped.