tags:

views:

334

answers:

2

I am using a TabWidget that contains a List in one tab. What I want to do is when a user selects an item, a webview is shown in that tab.

If the user then wants to go back to the list, they would click on the list tab.

I can get the webview up that replaces the whole tabwidget but don't know how to leave the tabs and show a webview.

Any help greatly appreciated

A: 

THIS IS NOT AN ANSWER, BUT COULD NOT GET ALL THIS INTO COMMENT

I have a TabWidget containing 3 tabs.

These are added using an intent as shown below

intent = new Intent().setClass(this, DuaList.class); spec = tabHost.newTabSpec("list").setIndicator("List", res.getDrawable(R.drawable.tab_sel)) .setContent(intent); tabHost.addTab(spec);

One of the tabs contains an expandable list. When the user clicks on a child, the following gets called:

public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Intent i = new Intent(); i.setClassName("com.ts", "com.ts.ShowData"); startActivity(i); return true; }

ShowData is an activity that contains a WebView. The above results in the WebView being shown that fills the screen.

What I would like to do is for the WebView to replace the expandable list view in the tab. Clicking on the actual tab should show the expandable list view again.

Taz
A: 

The trick is to use ActivityGroup!

http://stackoverflow.com/questions/1306689/launching-activities-within-a-tab-in-android

The fun bit then becomes how to be able to disable the original view in the tab....

This can be done by adding a OnClickListener for the partciular tab

getTabWidget().getChildAt().setOnClickListener(new OnClickListener() {

public void onClick(View v) {

}

Taz