Leela krishna
Newbie
public class TestingTab extends ActivityGroup {
LinearLayout ll;
TabHost tabHost;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
//ll = new LinearLayout(this);
tabHost = new TabHost(this);
setupTabHost();
setContentView(tabHost);
}
private void setupTabHost() {
TabWidget tabWidget = new TabWidget(this);
tabWidget.setId(android.R.id.tabs);
tabHost.addView(tabWidget);
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setId(android.R.id.tabcontent);
tabHost.addView(frameLayout);
tabHost.setFocusableInTouchMode(true);
tabHost.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
tabHost.setup(this.getLocalActivityManager());
TabSpec tab1 = tabHost.newTabSpec("palylist");
tab1.setIndicator("Playlist");
tab1.setContent(new Intent(this, VectorPlayList.class));
tabHost.addTab(tab1);
tabHost.addTab(tabHost.newTabSpec("serchfie").setIndicator("serchFile")
.setContent(new Intent(this, MyOwnBrowser.class)));
//ll.addView(tabHost);
}
}
public class VectorPlayList extends ListActivity {
private String[] mStrings = new String[MyOwnBrowser.playListVector.size()];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mStrings));
getListView().setTextFilterEnabled(true);
for (int i = 0; i < MyOwnBrowser.playListVector.size(); i++) {
mStrings = (String) MyOwnBrowser.playListVector.elementAt(i);
// System.out.println(m);
}
}
}
if i write the code like this
the content of VectorPlayList is overwriting the tabs
for that i am unable to select tabs.
please help me .
LinearLayout ll;
TabHost tabHost;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
//ll = new LinearLayout(this);
tabHost = new TabHost(this);
setupTabHost();
setContentView(tabHost);
}
private void setupTabHost() {
TabWidget tabWidget = new TabWidget(this);
tabWidget.setId(android.R.id.tabs);
tabHost.addView(tabWidget);
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setId(android.R.id.tabcontent);
tabHost.addView(frameLayout);
tabHost.setFocusableInTouchMode(true);
tabHost.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
tabHost.setup(this.getLocalActivityManager());
TabSpec tab1 = tabHost.newTabSpec("palylist");
tab1.setIndicator("Playlist");
tab1.setContent(new Intent(this, VectorPlayList.class));
tabHost.addTab(tab1);
tabHost.addTab(tabHost.newTabSpec("serchfie").setIndicator("serchFile")
.setContent(new Intent(this, MyOwnBrowser.class)));
//ll.addView(tabHost);
}
}
public class VectorPlayList extends ListActivity {
private String[] mStrings = new String[MyOwnBrowser.playListVector.size()];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mStrings));
getListView().setTextFilterEnabled(true);
for (int i = 0; i < MyOwnBrowser.playListVector.size(); i++) {
mStrings = (String) MyOwnBrowser.playListVector.elementAt(i);
// System.out.println(m);
}
}
}
if i write the code like this
the content of VectorPlayList is overwriting the tabs
for that i am unable to select tabs.
please help me .