android - Why does order of declaration matter for setting up a tab host? -


i setting tab host application , noticed order in declare each tab matters. when set this, application quits unexpectedly, before reaching activity:

    tabspec spec1 = th.newtabspec("tag1");     tabspec spec2 = th.newtabspec("tag2");     tabspec spec3 = th.newtabspec("tag3");      spec1.setcontent(r.id.tab1);     spec2.setcontent(r.id.tab2);     spec3.setcontent(r.id.tab3);      spec1.setindicator("stop watch");     spec2.setindicator("tab 2");     spec3.setindicator("tab 3");      th.addtab(spec1);     th.addtab(spec2);     th.addtab(spec3); 

when set this, application works fine:

    tabspec spec1 = th.newtabspec("tag1");     spec1.setcontent(r.id.tab1);     spec1.setindicator("stopwatch");     th.addtab(spec1);      tabspec spec2 = th.newtabspec("tag2");     spec2.setcontent(r.id.tab2);     spec2.setindicator("tab 2");     th.addtab(spec2);      tabspec spec3 = th.newtabspec("tag3");     spec3.setcontent(r.id.tab3);     spec3.setindicator("add tab");     th.addtab(spec3); 

why 1 work or not other? below, (some of) console , logcat output shown: console:

activitymanager: warning: activity not started, current task has been brought front 

logcat:

fatal exception: main java.lang.runtimeexception: unable instantiate activity  componentinfo{com.example.secondapp/com.example.secondapp.mangalist}: java.lang.nullpointerexception shutting down vm threadid=1: thread exiting uncaught exception (group=0x41b8a2a0)  caused by: java.lang.nullpointerexception @ android.app.activity.findviewbyid(activity.java:1882) @ com.example.secondapp.mangalist.<init>(mangalist.java:15) 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -