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

Runtime Exception #16

Closed
ytheekshana opened this issue Mar 22, 2019 · 2 comments
Closed

Runtime Exception #16

ytheekshana opened this issue Mar 22, 2019 · 2 comments

Comments

@ytheekshana
Copy link

ytheekshana commented Mar 22, 2019

Hi. I am using your library in my app. I got a Runtime Exception only on some devices. I cant figure out why... Here's the log

`Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=6937, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.ytheekshana.deviceinfo/com.nabinbhandari.android.permissions.PermissionsActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
   at android.app.ActivityThread.deliverResults(ActivityThread.java:4926)
   at android.app.ActivityThread.handleSendResult(ActivityThread.java:4969)
   at android.app.ActivityThread.access$1600(ActivityThread.java:222)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1850)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:158)
   at android.app.ActivityThread.main(ActivityThread.java:7230)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)`

In my fragment

        `HorizontalScrollView scrollViewCamera = rootView.findViewById(R.id.scrollViewCamera);
        cameraButtonGroup = rootView.findViewById(R.id.cameraButtonGroup);
        recyclerCamera = rootView.findViewById(R.id.recyclerCamera);
        Button btnCameraPermission = rootView.findViewById(R.id.btnCameraPermission);

        if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
            btnCameraPermission.setVisibility(View.VISIBLE);
            scrollViewCamera.setVisibility(View.GONE);
            recyclerCamera.setVisibility(View.GONE);
        } else {
            btnCameraPermission.setVisibility(View.GONE);
            scrollViewCamera.setVisibility(View.VISIBLE);
            recyclerCamera.setVisibility(View.VISIBLE);
            loadCameraAll();
        }
        btnCameraPermission.setOnClickListener(view -> Permissions.check(context, Manifest.permission.CAMERA, null, new PermissionHandler() {
            @Override
            public void onGranted() {
                btnCameraPermission.setVisibility(View.GONE);
                scrollViewCamera.setVisibility(View.VISIBLE);
                recyclerCamera.setVisibility(View.VISIBLE);
                loadCameraAll();
            }

            @Override
            public void onDenied(Context context, ArrayList<String> deniedPermissions) {
            }
        }));`

Any fix for this ?
Happened in 4 devices with Android 6.0. Looks like this bug is only in Marshmallow devices.

@nabinbhandari
Copy link
Owner

nabinbhandari commented Mar 24, 2019

Can you provide me with the minimal code that leads to crash, or guide me how to reproduce it?

@ytheekshana
Copy link
Author

Fixed it. The issue was on my side. Thanks

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

2 participants