1. Download our Official Android App: Forums for Android!

Apps Select item in the list view programmatically

Discussion in 'Android Development' started by AKA001, Mar 3, 2016.

  1. AKA001

    AKA001 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Feb 10, 2016

    Feb 10, 2016
    9
    0
    5
    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.
     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,843
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,843
    11,445
    1,988
    Male
    Software developer
    South West of England

Share This Page

Loading...