You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2904)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2986)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1671)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:206)
at android.app.ActivityThread.main(ActivityThread.java:6784)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:852)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.********.ui.PrivateOnlinePostsFragments: could not find Fragment constructor
at androidx.fragment.app.Fragment.instantiate(Fragment.java:563)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:390)
at androidx.fragment.app.FragmentStateManager.<init>(FragmentStateManager.java:74)
at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2466)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:196)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:287)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:115)
at com.********.ui.MainActivity.onCreate(MainActivity.kt:63)
at android.app.Activity.performCreate(Activity.java:6984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1235)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2857)
... 10 more
Caused by: java.lang.NoSuchMethodException: <init> []
at java.lang.Class.getConstructor0(Class.java:2320)
at java.lang.Class.getConstructor(Class.java:1725)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:548)
... 21 more
frag-nav:3.3.0
The text was updated successfully, but these errors were encountered:
using super.onCreate(null) in MainActivity's onCreate as a workaround for now
Mohammad-Adam
changed the title
help asap plz: "Unable to instantiate fragment" when restore app from background after a long time
"Unable to instantiate fragment" when restore app from background after a long time
Jan 27, 2021
This happen when we use parameterized constructor for fragment. If you want to pass parameter in fragment, then try passing it in bundle e.g in your case
public static final PrivateOnlinePostsFragments newInstance(int title, String message){
PrivateOnlinePostsFragments fragment = new PrivateOnlinePostsFragments();
Bundle bundle = new Bundle(2);
bundle.putInt(EXTRA_TITLE, title);
bundle.putString(EXTRA_MESSAGE, message);
fragment.setArguments(bundle);
return fragment ;
}
Stack trace:
frag-nav:3.3.0
The text was updated successfully, but these errors were encountered: