开发者

Using ListView to open different WebViews

I have completed the Hello Views tutorial from android developers (http://developer.android.com/resources/tutorials/views/hello-listview.html)

I understood the concept, but it doesn't fit my project. I'm trying to make a list and when clicked I want it to open a webView with d开发者_JAVA技巧ifferent URL's depending of which item is clicked.

I can't figure out which code I need to use...


you just need to set up an OnItemClickListener for the listView:

http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html

Declare a new Webview at the top then within this OnItemClickListener set up a switch statment to assign the URL to the WebView depending on which item in the ListView was clicked. Then out side of the switch statment, but inside the OnItemClickListener, call on the WebView.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜