Unable To Get Bitmap From Uri
I seem to be having trouble creating a Bitmap from fileUri. I would like to be able to set this Bitmap to an Imageview for previewing the image, and later adding elements to the i
Solution 1:
It appears as if I have found a solution.
http://www.androidhive.info/2013/09/android-working-with-camera-api/
* Display image from a path to ImageView
*/
privatevoidpreviewCapturedImage() {
try {
// bimatp factory
BitmapFactory.Optionsoptions=newBitmapFactory.Options();
// downsizing image as it throws OutOfMemory Exception for larger// images
options.inSampleSize = 8;
finalBitmapbitmap= BitmapFactory.decodeFile(fileUri.getPath(),
options);
m_ImageView.setImageBitmap(bitmap);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
Post a Comment for "Unable To Get Bitmap From Uri"