Hi everybody! I am pretty new to Android programming, but I do know Java (and a bit of XML)... still I can't understand where's the problem in this case.
What I want is a Tab Layout that contains, for each tab, a different view. public class MyApp extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, DatiAttrib.class); // Initialize a TabSpec for each tab and add it to the TabHost spec = tabHost.newTabSpec("artists").setIndicator("First Tab").setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, AbilArc.class); spec = tabHost.newTabSpec("albums").setIndicator("Second Tab").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, DifesePregi.class); spec = tabHost.newTabSpec("songs").setIndicator("Third Tab").setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); } } ...just like the Tab Layout tutorial. Then I coded every different view in a XML file, each referred by a .java file (a Class that extends Activity) pretty much like this: public class DatiAttrib extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.datiattrib); } } Where datiattrib.xml is the layout file. When it comes to testing,though, the program shows an error and forces to exit. Is there anything wrong with this approach? Thanks! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en