Question

    Intent i = getIntent();
    mPathString = i.getStringExtra("imagepathstring");
    Toast.makeText(getApplicationContext(), mPathString, Toast.LENGTH_LONG).show();

    try {
        Bitmap temp = BitmapFactory.decodeFile(mPathString);
        capturedImageView.setImageBitmap(temp);
    } catch (Exception e) {
        // TODO: handle exception
    }

Here the code runs perfectly and even the toast displays the correct path of the image that I am storing on external storage. But still the image does not appear on the imageview. And if i remove the try and catch block surrounding bitmap object then my app fails with nullpointer exception. Can any one help to figure out what mistake I have done..? Thank you

Was it helpful?

Solution

Check that you have initialized you capturedImageView. I think that your capturedImageView is null.

OTHER TIPS

please set your capturedImageView with layout imageview. i think then it works fine.

ImageView capturedImageView;
capturedImageView=(ImageView)findViewById(R.id.capturedImageView);
 mPathString = i.getExtra.getString("imagepathstring");

What is the path you are using, and how are you generating it? It may not be exactly right.

Ah, and Roman Black may be right.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top