How to disable the particular list item in list-view in android? I mean if once i selected any one of item from a list-view,that item suppose to be disabled which means that item should not be select-able again. How to do this?
Suggestions please
Thanks for your precious time!..
To remove items programmaticallyUse the RemoveAt or Clear method of the Items property. The RemoveAt method removes a single item; the Clear method removes all items from the list.
OnItemClickListener MshowforItem = new AdapterView. OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ((TextView)view). setText("Hello"); } };
Android ListView is a view which groups several items and display them in vertical scrollable list. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database.
try using this code in setOnItemClicklistener()
if(listview.getChildAt(selectedPosition).isEnabled())
{
listview.getChildAt(selectedPosition).setEnabled(false);
}
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