android - How to select ListView Item in Java code? -


i have android listview has 5 items. general speaking, if listview item selected keyboard(the key , down etc), change background , text color. want select 3th item in java code , hope change background , text color use keyboard select it. how can achieve that? way, there 1 selected @ same time , wasn’t selected black usual. appreciated if can give me advice , !

yes can:

listview mylist=(listview) findviewbyid(r.id.listview01);  mylist.setfocusableintouchmode(true); mylist.setselection(1); 

where 1 represents second item in list (its position, starting @ zero)


Comments