Android runtime error: "FATAL EXCEPTION", instantiating ListFragment and adding to ActionBar -
the complaint appears listfragment creating view: public class medslistactivity extends activity implements listselectionlistener{
public static arraylist<medication> lm; private final static meddetailfragment meddetailfragment = new meddetailfragment(); private final static medlistfragment medlistfragment = new medlistfragment(); private fragmentmanager mfragmentmanager; /* (non-javadoc) * @see android.app.activity#oncreate(android.os.bundle) */ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_medlist); populatemedlist(); addtabs(); } private void addtabs(){ final actionbar actionbar = getactionbar(); actionbar.settitle("rxshare"); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); actionbar.setdisplayshowtitleenabled(false); tab tab = actionbar.newtab().settext(r.string.action_medlist); medlistfragment mlf = new medlistfragment(); tab.settablistener(new tablistener(mlf)); actionbar.addtab(tab); } ... } public class medlistfragment extends listfragment { private final static string log_tag = medlistfragment.class.getcanonicalname(); private arraylist<medication> lm; listselectionlistener mlistener = null; int mcurridx = -1; public interface listselectionlistener { public void onlistselection(int index); } @override public void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); sethasoptionsmenu(false); setretaininstance(true); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { string datastring[] = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" }; listadapter myadapter = new arrayadapter<string>(getactivity(), android.r.layout.simple_expandable_list_item_1, datastring); setlistadapter(myadapter); return super.oncreateview(inflater, container, savedinstancestate); }
the parent activity layout xml(r.layout.activity_medlist) following:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" />
this results in following stacktrace in eclipse console:
08-18 17:17:07.914: e/fragmentmanager(2303): no view found id 0x7f0a0019 (com.rxshare:id/action_medlist) fragment medlistfragment{40cd9158 #0 id=0x7f0a0019} 08-18 17:17:07.914: e/fragmentmanager(2303): activity state: 08-18 17:17:07.924: e/fragmentmanager(2303): local activity 40d786c0 state: 08-18 17:17:07.934: e/fragmentmanager(2303): mresumed=false mstopped=false mfinished=false 08-18 17:17:07.934: e/fragmentmanager(2303): mloadersstarted=false 08-18 17:17:07.944: e/fragmentmanager(2303): mchangingconfigurations=false 08-18 17:17:07.944: e/fragmentmanager(2303): mcurrentconfig={1.0 310mcc260mnc en_us ldltr sw360dp w360dp h567dp 320dpi nrml port finger -keyb/v/h -nav/h s.6} 08-18 17:17:07.954: e/fragmentmanager(2303): active fragments in 40d787b0: 08-18 17:17:07.954: e/fragmentmanager(2303): #0: medlistfragment{40cd9158 #0 id=0x7f0a0019} 08-18 17:17:07.964: e/fragmentmanager(2303): mfragmentid=#7f0a0019 mcontainerid=#7f0a0019 mtag=null 08-18 17:17:07.964: e/fragmentmanager(2303): mstate=0 mindex=0 mwho=android:fragment:0 mbackstacknesting=0 08-18 17:17:07.964: e/fragmentmanager(2303): madded=true mremoving=false mresumed=false mfromlayout=false minlayout=false 08-18 17:17:07.974: e/fragmentmanager(2303): mhidden=false mdetached=false mmenuvisible=true mhasmenu=false 08-18 17:17:07.974: e/fragmentmanager(2303): mretaininstance=true mretaining=false muservisiblehint=true 08-18 17:17:07.974: e/fragmentmanager(2303): mfragmentmanager=fragmentmanager{40d787b0 in medslistactivity{40d786c0}} 08-18 17:17:07.974: e/fragmentmanager(2303): mactivity=com.rxshare.medslistactivity@40d786c0 08-18 17:17:07.984: e/fragmentmanager(2303): added fragments: 08-18 17:17:07.984: e/fragmentmanager(2303): #0: medlistfragment{40cd9158 #0 id=0x7f0a0019} 08-18 17:17:07.994: e/fragmentmanager(2303): fragmentmanager misc state: 08-18 17:17:07.994: e/fragmentmanager(2303): mactivity=com.rxshare.medslistactivity@40d786c0 08-18 17:17:07.994: e/fragmentmanager(2303): mcontainer=android.app.activity$1@40d78828 08-18 17:17:08.004: e/fragmentmanager(2303): mcurstate=2 mstatesaved=false mdestroyed=false 08-18 17:17:08.004: e/fragmentmanager(2303): view hierarchy: 08-18 17:17:08.004: e/fragmentmanager(2303): com.android.internal.policy.impl.phonewindow$decorview{40d792f0 v.e..... r.....id 0,0-0,0} 08-18 17:17:08.014: e/fragmentmanager(2303): android.widget.linearlayout{40d799b8 v.e..... ......i. 0,0-0,0} 08-18 17:17:08.024: e/fragmentmanager(2303): com.android.internal.widget.actionbarcontainer{40d7a598 v.ed.... ......id 0,0-0,0 #1020359 android:id/action_bar_container} 08-18 17:17:08.024: e/fragmentmanager(2303): com.android.internal.widget.actionbarview{40d7ab80 v.e..... ......id 0,0-0,0 #102035a android:id/action_bar} 08-18 17:17:08.024: e/fragmentmanager(2303): android.widget.linearlayout{40d7bc98 v.....c. ......i. 0,0-0,0} 08-18 17:17:08.034: e/fragmentmanager(2303): com.android.internal.widget.actionbarview$homeview{40d7cdb8 v.e..... ......i. 0,0-0,0} 08-18 17:17:08.034: e/fragmentmanager(2303): android.widget.imageview{40d7d218 g.ed.... ......i. 0,0-0,0 #1020246 android:id/up} 08-18 17:17:08.044: e/fragmentmanager(2303): android.widget.imageview{40d7d598 v.ed.... ......i. 0,0-0,0 #102002c android:id/home} 08-18 17:17:08.054: e/fragmentmanager(2303): com.android.internal.widget.actionbarcontextview{40d807c0 g.e..... ......id 0,0-0,0 #102035b android:id/action_context_bar} 08-18 17:17:08.054: e/fragmentmanager(2303): com.android.internal.widget.scrollingtabcontainerview{40d82850 vfed.... ......i. 0,0-0,0} 08-18 17:17:08.054: e/fragmentmanager(2303): android.widget.linearlayout{40d77120 v.ed.... ......i. 0,0-0,0} 08-18 17:17:08.064: e/fragmentmanager(2303): com.android.internal.widget.scrollingtabcontainerview$tabview{40cdf7e0 vfe...c. ..s...i. 0,0-0,0} 08-18 17:17:08.064: e/fragmentmanager(2303): android.widget.textview{40cd8db8 v.ed.... ..s...i. 0,0-0,0} 08-18 17:17:08.074: e/fragmentmanager(2303): android.widget.framelayout{40d80d38 v.ed.... ......i. 0,0-0,0 #1020002 android:id/content} 08-18 17:17:08.074: e/fragmentmanager(2303): android.widget.framelayout{40d81dc8 v.e..... ......i. 0,0-0,0 #1020011 android:id/tabcontent} 08-18 17:17:08.074: e/fragmentmanager(2303): com.android.internal.widget.actionbarcontainer{40d811b8 g.ed.... ......id 0,0-0,0 #102035c android:id/split_action_bar} 08-18 17:17:08.104: d/androidruntime(2303): shutting down vm 08-18 17:17:08.104: w/dalvikvm(2303): threadid=1: thread exiting uncaught exception (group=0x40a71930) 08-18 17:17:08.143: e/androidruntime(2303): fatal exception: main 08-18 17:17:08.143: e/androidruntime(2303): java.lang.runtimeexception: unable start activity componentinfo{com.rxshare/com.rxshare.medslistactivity}: java.lang.illegalargumentexception: no view found id 0x7f0a0019 (com.rxshare:id/action_medlist) fragment medlistfragment{40cd9158 #0 id=0x7f0a0019} 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread.performlaunchactivity(activitythread.java:2180) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2230) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread.access$600(activitythread.java:141) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread$h.handlemessage(activitythread.java:1234) 08-18 17:17:08.143: e/androidruntime(2303): @ android.os.handler.dispatchmessage(handler.java:99) 08-18 17:17:08.143: e/androidruntime(2303): @ android.os.looper.loop(looper.java:137) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread.main(activitythread.java:5041) 08-18 17:17:08.143: e/androidruntime(2303): @ java.lang.reflect.method.invokenative(native method) 08-18 17:17:08.143: e/androidruntime(2303): @ java.lang.reflect.method.invoke(method.java:511) 08-18 17:17:08.143: e/androidruntime(2303): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 08-18 17:17:08.143: e/androidruntime(2303): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 08-18 17:17:08.143: e/androidruntime(2303): @ dalvik.system.nativestart.main(native method) 08-18 17:17:08.143: e/androidruntime(2303): caused by: java.lang.illegalargumentexception: no view found id 0x7f0a0019 (com.rxshare:id/action_medlist) fragment medlistfragment{40cd9158 #0 id=0x7f0a0019} 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:877) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1057) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.backstackrecord.run(backstackrecord.java:682) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1435) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activity.performstart(activity.java:5113) 08-18 17:17:08.143: e/androidruntime(2303): @ android.app.activitythread.performlaunchactivity(activitythread.java:2153) 08-18 17:17:08.143: e/androidruntime(2303): ... 11 more
Comments
Post a Comment