Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE : Attempt to invoke virtual method 'void android.support.v4.app.FragmentManager.popBackStack()' on a null object reference #25

Open
veiz opened this issue Aug 2, 2016 · 8 comments

Comments

@veiz
Copy link

veiz commented Aug 2, 2016

Application crashed if using support library. Try to use getSupportedFragmentManager instead.

public void dismiss() {
    if (mDismissed) {
        return;
    }
    mDismissed = true;
    new Handler().post(new Runnable() {
        public void run() {
            getFragmentManager().popBackStack();
            FragmentTransaction ft = getFragmentManager().beginTransaction();
            ft.remove(ActionSheet.this);
            ft.commitAllowingStateLoss();
        }
    });
}
@baoyongzhang
Copy link
Owner

Please provide exception stack trace.

@veiz
Copy link
Author

veiz commented Aug 16, 2016

java.lang.NullPointerException
    at com.baoyz.actionsheet.ActionSheet$2.run(ActionSheet.java:107)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5143)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
    at dalvik.system.NativeStart.main(Native Method)

@monkeyfdude
Copy link

Any updates on this issue? I observe the same issue.

@lpf-gavin
Copy link

I also find this problem,can you fix it?Thanks

@lpf-gavin
Copy link

I use it in "public void onBackPressed()", maybe something is released after calling this method, so get a NullPointerException, maybe there is some bug in your projrct?

@lpf-gavin
Copy link

I solved it, make "onBackPressed" running on another thread is ok!

@laconichy
Copy link

I also had the problem. setCancelableOnTouchOutside (true), this problem must occur when I always click on the event. This problem sometimes occurs when setCancelableOnTouchOutside (false).
@veiz What is your solution ? help me .

@laconichy
Copy link

My solution is to prevent duplicate clicks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants