Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy UnCaught Exception occurs in a TabActivity?
    text
    copied!<p>I have created a TabActivity and added TabWidget and frame to the layout.</p> <p>I have four other Activity classes with single label in each Activity. Four tabs are associated with four tabs.</p> <p>When I am trying to launch the application in emulator, I am getting the below exception</p> <blockquote> <p>09-03 23:24:43.905: ERROR/AndroidRuntime(450): java.lang.NullPointerException 09-03 23:24:43.905: ERROR/AndroidRuntime(450): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:295) 09-03 23:24:43.905: ERROR/AndroidRuntime(450): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661) 09-03 23:24:43.905: ERROR/AndroidRuntime(450): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)</p> </blockquote> <pre><code>public class TabHome extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost tabHost=getTabHost(); TabHost.TabSpec tabSpec; Resources res=getResources(); Intent intent; intent=new Intent().setClass(this, MyMap.class); tabSpec= tabHost.newTabSpec("Maps").setIndicator("Maps",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent); tabHost.addTab(tabSpec); intent=new Intent().setClass(this, MyStash.class); tabSpec= tabHost.newTabSpec("Stash").setIndicator("Stash",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent); tabHost.addTab(tabSpec); intent=new Intent().setClass(this, MyList.class); tabSpec= tabHost.newTabSpec("List").setIndicator("List",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent); tabHost.addTab(tabSpec); intent=new Intent().setClass(this, MySearch.class); tabSpec= tabHost.newTabSpec("Search").setIndicator("Search",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent); tabHost.addTab(tabSpec); tabHost.setCurrentTab(2); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload