Manual call to onListItemCLick
I am using a ListView with a SimpleAdapter. Once data is populated into it I 开发者_运维百科would like to set the first item in the list. This can be done by clicking on the list item on the screen. I want to just call the method directly after I populate the list so that when you see the UI its already done. My only problem is getting the View from the ListView. I noticed its children are all null but the SimpleAdapter has items in it. When I try to get those items they are not Views and I am not able to match the method call of
protected void onListItemClick(ListView l, View v, int position, long id)
because I cant get the right View. Any help would be appreciated.
After lots of searching the solution is not to make a manual call but to override the adapter getView method. That way I can change the background color and not have to manually call onListItemClick()
精彩评论