RxPermissions icon indicating copy to clipboard operation
RxPermissions copied to clipboard

# java.lang.IllegalStateException:Activity has been destroyed

Open henryhong111 opened this issue 7 years ago • 3 comments

#102 java.lang.IllegalStateException Activity has been destroyed com.tbruyelle.rxpermissions2.RxPermissions.getRxPermissionsFragment(RxPermissions.java:53)

henryhong111 avatar Dec 15 '17 06:12 henryhong111

any help on this?

abhi-scenedoc avatar Apr 06 '18 17:04 abhi-scenedoc

Provide more info with full code snippet (to see how and when you call RxPermissions methods), please. Also, if you want to get help you better provide some more description how we could reproduce this issue, device info etc.

You know, I think this issue appears when you rotating activity but somewhere reference to previous is saved and with this reference you try to get RxPermission...

mrArtCore avatar Apr 11 '18 14:04 mrArtCore

Provide more info with full code snippet (to see how and when you call RxPermissions methods), please. Also, if you want to get help you better provide some more description how we could reproduce this issue, device info etc.

You know, I think this issue appears when you rotating activity but somewhere reference to previous is saved and with this reference you try to get RxPermission...

I have met the same problem in Huawei roms. Exceptions: java.lang.IllegalStateException Activity has been destroyed

This is my code :

When Activity onCreate I called:
 try {
            new RxPermissions(this)
                    .request(Manifest.permission.READ_PHONE_STATE)
                    .subscribe(new Consumer<Boolean>() {
                        @Override
                        public void accept(Boolean aBoolean) throws Exception {
                            //do something
                        }
                    });
        } catch (Exception e) {
            //huawei emui maybe crash
             //do something
        }

It seems the activity has been onDestroy and onCreate at once. rxpermissions:0.9.5@aar

1wayticket avatar Feb 04 '20 05:02 1wayticket