app crashing - java.lang.IllegalStateException - Fragment com.myapp.android.MyAppActivity did not create a view -
i have activity extends sherlockfragmentactivity , implements actionbar.tablistener.
here's xml looks like:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/fragment_layout" tools:context=".myappactivity" > <fragment android:id="@+id/tab_content" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:name="com.myapp.android.myappwebviewfragment" /> </linearlayout>
it's crashing on setcontentview, activity_welcome xml given above.
@suppresslint("setjavascriptenabled") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_welcome); ...
java.lang.illegalstateexception in myappactivity.java:154 fragment com.myapp.android.myappactivity did not create view.
here's fragment's oncreateview looks like:
public class myappwebviewfragment extends sherlockfragment{ ... @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view web = inflater.inflate(r.layout.myapp_webview_fragment, container, false); pulltorefreshview = (pulltorefreshwebview) web.findviewbyid(r.id.tab_content); return web; } public void onviewcreated(view view, bundle savedinstancestate) { super.onviewcreated(view, savedinstancestate); final activity activity = getactivity(); if(url != null){ ... }
any idea why might happening?
edit
stack trace:
java.lang.illegalstateexception: fragment com.myapp.android.myappwebviewfragment did not create view. fragmentactivity.java:303 • android.support.v4.app.fragmentactivity.oncreateview layoutinflater.java:563 • android.view.layoutinflater.createviewfromtag layoutinflater.java:623 • android.view.layoutinflater.rinflate layoutinflater.java:408 • android.view.layoutinflater.inflate layoutinflater.java:320 • android.view.layoutinflater.inflate layoutinflater.java:276 • android.view.layoutinflater.inflate actionbarsherlockcompat.java:840 • com.actionbarsherlock.internal.actionbarsherlockcompat.setcontentview sherlockfragmentactivity.java:262 • com.actionbarsherlock.app.sherlockfragmentactivity.setcontentview myappactivity.java:154 • com.myapp.android.myappactivity.oncreate instrumentation.java:1047 • android.app.instrumentation.callactivityoncreate activitythread.java:1617 • android.app.activitythread.performlaunchactivity activitythread.java:1669 • android.app.activitythread.handlelaunchactivity activitythread.java:117 • android.app.activitythread.access$1500 activitythread.java:937 • android.app.activitythread$h.handlemessage handler.java:99 • android.os.handler.dispatchmessage looper.java:130 • android.os.looper.loop activitythread.java:3692 • android.app.activitythread.main method.java:-2 • java.lang.reflect.method.invokenative method.java:507 • java.lang.reflect.method.invoke zygoteinit.java:842 • com.android.internal.os.zygoteinit$methodandargscaller.run zygoteinit.java:600 • com.android.internal.os.zygoteinit.main nativestart.java:-2 • dalvik.system.nativestart.main
Comments
Post a Comment