How to solve DATA null issue that occured when capturing image through camera
<p><BR>
I am writing an Android application where I need to display Image Captured through Camera.
I am using Android 2.1 I tested in emulator. I am trying to capture the image  , but how to display the captured Image on Screen.
<br>
My activity is as follows:</p>

<pre><code>public class ImageCaptureActivity extends Activity {
                /** Called when the activity is first created. */   
                @Override    
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    Uri mImageCaptureUri = Uri.fromFile(new File(
                            "/sdcard/gift2.JPG"));
                    Intent intent = new Intent(
                            "android.media.action.IMAGE_CAPTURE");
                    intent.putExtra(
                            android.provider.MediaStore.EXTRA_OUTPUT,
                            mImageCaptureUri);
                    startActivityForResult(intent, 0);
                }

                protected void onActivityResult(int requestCode,
                        int resultCode, Intent data) {
                    if (requestCode == 0
                            &amp;&amp; resultCode == Activity.RESULT_OK) {
                        Toast.makeText(getBaseContext(), "ImageCaptured",
                                Toast.LENGTH_LONG).show();
                        Uri chosenImageUri = data.getData();
                        Bitmap mBitmap = null;
                        try {
                            mBitmap = Media.getBitmap(
                                    this.getContentResolver(),
                                    chosenImageUri);
                        } catch (FileNotFoundException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        } catch (IOException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                        ImageView img = new ImageView(this);
                        img.setImageBitmap(mBitmap);
                        setContentView(img);
                    }
                }
</code></pre>

<p>When I execute this class . After capturing image  through camera and clicking  "ok" I am getting null pointer exception at  the statement "Uri chosenImageUri = data.getData();" <br>
Can anyone help me in sorting out this issue.</p>

<p><br>
Thanks in Advance.</p>
