Selected positions in a listview

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Selected positions in a listview

Postby henri51 » Thu Aug 27, 2009 5:01 pm

How can I retrieve the positions of the selected item in a multichoice listView ?
The getSelectedItemPosition method returns only the first one...
henri51
Junior Developer
Junior Developer
 
Posts: 11
Joined: Wed Jun 10, 2009 4:10 pm

Top

Postby marbalon » Fri Sep 04, 2009 12:02 pm

Hi,
I'm using this code to get position for onContextItemSelected() method
Code: Select all
...
public boolean onContextItemSelected(MenuItem item) {
       AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
       Selected = info.position;

...

Maybe this help.
marbalon
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Aug 25, 2009 11:29 am

Postby kec6227 » Fri Sep 04, 2009 4:01 pm

getCheckedItemPositions()

http://developer.android.com/reference/ ... ions%28%29

It returns a SparseBooleanArray which is essentially a map of each position number to a true value where checked off.
kec6227
Developer
Developer
 
Posts: 30
Joined: Fri Jul 24, 2009 7:31 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests