• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Select item in the list view programmatically

AKA001

Newbie
Feb 10, 2016
10
0
Hello Everyone,



I have an ArrayList<String> List which contains some items from the listview all_list. How can I select these items in the list view all_list programmatically by checking the ArrayList<String> List contents?



for e.g., listview all_list contains [0] apple

[1] orange

[2] banana



In ArrayList<String> List, I have orange so I want item on position 1 on the listview all_list to be selected (highlighted) automatically.



I have tried using all_list.setItemChecked(), but it does nothing and shuts down the application. I am performing the operation after listing the adapter.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones