Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your "barf".
On Wed, Sep 29, 2010 at 8:39 PM, Saied <saie...@gmail.com> wrote: > Hi, > > I am using the Tab Layout almost copied from the example provided. But > it's not working: > > public class TabHolder extends TabActivity { > /** Called when the activity is first created. */ > �...@override > 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, ArtistsActivity.class); > > // Initialize a TabSpec for each tab and add it to the TabHost > spec = tabHost.newTabSpec("artists").setIndicator("Artists", > res.getDrawable(R.drawable.ic_tab_info)) > .setContent(intent); > > // ok up to here > tabHost.addTab(spec); // barfs right here ************** > > > // Do the same for the other tabs > intent = new Intent().setClass(this, > MessagEaseSettings.class); > spec = tabHost.newTabSpec("settings").setIndicator("Settings", > res.getDrawable(R.drawable.ic_tab_settings)) > .setContent(intent); > tabHost.addTab(spec); > > intent = new Intent().setClass(this, SongsActivity.class); > spec = tabHost.newTabSpec("how").setIndicator("How", > res.getDrawable(R.drawable.ic_tab_how)) > .setContent(intent); > tabHost.addTab(spec); > > tabHost.setCurrentTab(2); > } > > } > > > > seems that the problem happens when it adds the spec: > > tabHost.addTab(spec); > > But there is not much to this: > > intent = new Intent().setClass(this, ArtistsActivity.class); > > // Initialize a TabSpec for each tab and add it to the TabHost > spec = tabHost.newTabSpec("artists").setIndicator("Artists", > res.getDrawable(R.drawable.ic_tab_info)) > .setContent(intent); > > the activity (ArtistsActivity) exists and passes Eclipse's strict > checks. > > the strings "artists" and "Artists" should not matter, and they are > taken from the exmple. > > and the drawalbe.ic.tab.info does exist, exactly as the example > requires it: > > > <?xml version="1.0" encoding="utf-8"?> > <selector xmlns:android="http://schemas.android.com/apk/res/android"> > <!-- When selected, use grey --> > <item android:drawable="@drawable/tab_info_gray" > android:state_selected="true" /> > <!-- When not selected, use white--> > <item android:drawable="@drawable/tab_info_white" /> > </selector> > > > Can anyone give me a hint as to where to look for? Any help is much > appreciated. > > Best, > > Saied > > > > -- > 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 > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- 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