Reputation: 1681
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
Upvotes: 0
Views: 88
Reputation: 85
please set your capturedImageView with layout imageview. i think then it works fine.
ImageView capturedImageView;
capturedImageView=(ImageView)findViewById(R.id.capturedImageView);
Upvotes: 2
Reputation: 279
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.
Upvotes: 0
Reputation: 3497
Check that you have initialized you capturedImageView
. I think that your capturedImageView
is null
.
Upvotes: 2