I am working on an android application and I am trying to follow the guidelines for the Ice Cream Sandwich UI.
I have a ListActivity which contains a ListView and within the ListView I am have a TextView for each item within an ArrayAdapter. When I want to be able to do, is once the user long clicks on an item within the ListView and Context Activity Bar is shown and the item that was long clicked is now in a selected state. From there the user can then click on multiple items within the ListView making them all selected and then the user can press a button within the ActionBar to perform an action on all selected items within the ListView.
I've got it triggering to show the context activity bar when the item is long clicked but I have no idea how I can make the item appear selected and allow the user to select/deselect the items within the ListView.
Thanks for your help
Use the <select> tag to create a selectable list. The HTML <select> tag is used within a form for defining a select list.
Try this: my_listview. setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { } });
In order to display items in the list, call setAdapter(android. widget. ListAdapter) to associate an adapter with the list. For a simple example, see the discussion of filling an adapter view with text in the Layouts guide. To display a more custom view for each item in your dataset, implement a ListAdapter.
Do as is described here.
How to highlight selected item in ListView?
Basically you need to set the multiselect listener and then selection type. Do what you need from the actionmode callbacks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With