tags:

views:

186

answers:

1

I have a TabActivity with a tab, which shows a list. I'd like to display a WebView whenever a list item is clicked. I tried calling listSpec.setContent(R.id.details); but it would not find the resource.

Any clues what I am doing wrong?

UPDATE: I found the following clue from Mark in the mailing list

You don't change the View inside of a tab. You cause the existing View to show something else (e.g., use FrameLayout and make one layer VISIBLE and another layer GONE, or use ViewFlipper to swap between contents).

You might be able to get setContent() to replace the current View by passing in another layout ID or TabContentFactory, but I'm skeptical this will work.

The tab widget framework in Android is designed for simple stuff. You may wish to grab the source code for the relevant classes out of Android and make your own version that handles your own scenario.

-- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy

A: 

I don't know if I'd trust the guy you got your update from. He's...he's...he's...he's balding!

;-)

The most common pattern on Android is for clicking a list item to bring up another activity. If for some reason you don't want that, then the advice I gave in your update is still valid -- you can achieve your effect by hiding the ListView and showing the WebView by one means or another.

CommonsWare
Mark, thanks for actively helping the android community out. I just signed up (commonsware yearly subscription) for just this fact.
vpdn
Thanks! I'm happy to help!
CommonsWare