Doubt about selecting items in the ListView

0

How do I do when I "click" the "Back" icon on Android and unselect all items in the ListView instead of quitting Activity?

    
asked by anonymous 14.09.2015 / 14:02

1 answer

3

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.

    
14.09.2015 / 15:03