java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1888, result=0, data=null} to activity

前端 未结 12 1260
你的背包
你的背包 2020-11-29 01:31

My app allows the user to press a button, it opens the camera, they can take a photo and it will show up in an imageview. If the user presses back or cancel while the camera

12条回答
  •  心在旅途
    2020-11-29 02:36

    I had this error message show up for me because I was using the network on the main thread and new versions of Android have a "strict" policy to prevent that. To get around it just throw whatever network connection call into an AsyncTask.

    Example:

        AsyncTask task = new AsyncTask() {
    
            @Override
            protected Void doInBackground(CognitoCachingCredentialsProvider... params) {
                AWSSessionCredentials creds = credentialsProvider.getCredentials();
                String id = credentialsProvider.getCachedIdentityId();
                credentialsProvider.refresh();
                Log.d("wooohoo", String.format("id=%s, token=%s", id, creds.getSessionToken()));
                return null;
            }
        };
    
        task.execute(credentialsProvider);
    

提交回复
热议问题