开发者

Manual call to onListItemCLick

开发者 https://www.devze.com 2023-01-15 05:53 出处:网络
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 wa

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()

0

精彩评论

暂无评论...
验证码 换一张
取 消