Android KitKat Error getting ResultInfo result?

I have a problem with onActivityResult

only on devices KitKat

, when the user selected an image or some file, the application got it force closed

, I checked Crashes and ANRS from google developer console and I found this error

STACK TRACES 1.1: Android application version 4.3 Y530 (hwY530-U00) Device java.lang.RuntimeException: Unable to resume activity {packageName.New_Post}: java.lang.RuntimeException: Abandoning ResultInfo {who = null, request = 2803, result = -1, data = Intent {dat = content: // media / external / images / media / 3528 flg = 0x1}} to action {} PackageName.New_Post: java.lang.NullPointerException on android.app.ActivityThread.performResumeActivity (ActivityThread.java:3012) at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3041) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2393) at android.app.ActivityThread.access $ 900 (ActivityThread.java : 148) at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1319) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:137) in android.app.ActivityThread.main (ActivityThread.java:5457) in java.lang.reflect.Method.invokeNative (native method) in java.lang.reflect.Method.invoke (Method. java: 525) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:854) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:670) at dalvik.system.NativeStart .main (native method) called by: java.lang.RuntimeException: discarding ResultInfo {who = null, request = 2803, result = -1, data = Intent {dat = content: // media / external / images / media / 3528 flg = 0x1}} to action {} PackageName.New_Post: java.lang.NullPointerException on android.app.ActivityThread.deliverResults (ActivityThread.java:3614) on android.app.ActivityThread.performResumeActivity (ActivityThread.java:2999) ... 12 more Cause: java.lang.NullPointerException at packageName.New_Post.onActivityResult (New_Post.java:343) at android.app.Activity.dispatchActivityResult (Activity.java:5442) at android.app.ActivityThread.deliverResults (ActivityThread.java:3610)

and this is the code:

protected void onActivityResult (int requestCode, int resultCode, Intent Data) {

  //if Sent from Attachment File Send information Back to It
  if ( requestCode == Api.UPLOAD_ATTACHMENT )
  {
      if (resultCode == RESULT_OK)
       {
           Uri uri         = data.getData();

           ContentValues info = new ContentValues();

           info.put("posthash", posthash);
           info.put("poststarttime", poststarttime);
           info.put("t", ShowThread.thread.threadid);
           info.put("p", p);
           info.put("editpost", 0);
           info.put("f", ShowThread.thread.forumid);
           info.put("perm", ( attcperm != null ) ? attcperm.toString() : "");

           new Attachment_upload( context  , uri , info ,attachments_box);  
       }

  }
}

      

I don't understand what I have resultCode == RESULT_OK

, so if the application doesn't return the attachment file, why are the results ok?

+3


source to share


1 answer


Your URI is wrong, try to get the absolute path



0


source







All Articles