I got stuck on the following issue:
I have a TabHost with several tabs with a ListView. No i want to start a new Activity inside the current tab when a list item is clicked. If a start a new activity onListItemClick it opens the activity fullscreen.
Using java Syntax Highlighting
- public class MyTabActivity extends TabActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.mytabactivity);
- final TabHost tabHost = getTabHost();
- TabSpec ts1 = tabHost.newTabSpec("Tab1");
- ts1.setIndicator("Tab1", null);
- ts1.setContent(new Intent(this, TabView1.class));
- tabHost.addTab(ts1);
- TabSpec ts2 = tabHost.newTabSpec("Tab2");
- ts2.setIndicator("Tab2", null);
- ts2.setContent(new Intent(this, TabView2.class));
- tabHost.addTab(ts2);
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
Using java Syntax Highlighting
- public class TabView1 extends ListActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.tabview1);
- SeparatedListAdapter adapter = new SeparatedListAdapter(this);
- //fill list adapter stuff
- setListAdapter(adapter);
- }
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- // TODO Auto-generated method stub
- super.onListItemClick(l, v, position, id);
- Intent i = new Intent(l.getContext(), Movies.class);
- startActivity(i);
- }
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Is my idea possible? Open a new intent in the current tab on a list item click?




