Note that there are some explanatory texts on larger screens.

plurals
  1. POresult cannot delivered
    primarykey
    data
    text
    <p>This app for testing use Builtin camera in android ??? what is the error in my code which cause this error</p> <p>i am starting camera and capture a photo then i want to display it in imageView</p> <p>i found that the photo stored in SDcard but cannot use it in onActivityResult method</p> <pre><code>package com.world.hello; import java.io.File; import android.app.Activity; import android.content.Intent; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; public class Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File( "/sdcard/Pictures/MyCameraApp/IMAG.jpg"))); startActivityForResult(intent, 100); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == 100) { Log.d("Image", data.getData().toString()); // ImageView iv = (ImageView) findViewById(R.id.imageView1); // iv.setImageBitmap(BitmapFactory.decodeFile(data.getData().toString())); } } } } </code></pre> <p>Why this error ??</p> <pre><code>05-24 17:19:40.164: E/AndroidRuntime(4759): FATAL EXCEPTION: main 05-24 17:19:40.164: E/AndroidRuntime(4759): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=null} to activity {com.world.hello/com.world.hello.Main}: java.lang.NullPointerException 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread.deliverResults(ActivityThread.java:2980) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread.access$1100(ActivityThread.java:123) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.os.Handler.dispatchMessage(Handler.java:99) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.os.Looper.loop(Looper.java:137) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-24 17:19:40.164: E/AndroidRuntime(4759): at java.lang.reflect.Method.invokeNative(Native Method) 05-24 17:19:40.164: E/AndroidRuntime(4759): at java.lang.reflect.Method.invoke(Method.java:511) 05-24 17:19:40.164: E/AndroidRuntime(4759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 05-24 17:19:40.164: E/AndroidRuntime(4759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 05-24 17:19:40.164: E/AndroidRuntime(4759): at dalvik.system.NativeStart.main(Native Method) 05-24 17:19:40.164: E/AndroidRuntime(4759): Caused by: java.lang.NullPointerException 05-24 17:19:40.164: E/AndroidRuntime(4759): at com.world.hello.Main.onActivityResult(Main.java:40) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.Activity.dispatchActivityResult(Activity.java:4649) 05-24 17:19:40.164: E/AndroidRuntime(4759): at android.app.ActivityThread.deliverResults(ActivityThread.java:2976) 05-24 17:19:40.164: E/AndroidRuntime(4759): ... 11 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload