I have two problems in my program:
1.After taking a picture, this is what I have for onActivityResult():
pictureTaken = (Bitmap) data.getExtras().get("data");
ImageView im = (ImageView) findViewById(R.id.view);
im.setImageBitmap(pictureTaken);
This displays only a thumbnail (bad quality when displayed), and when I save it to the SD card, it is also a small image. What I need is to save/display it in it’s full resolution/quality. What do I change to achieve this?
-
Retrieving and displaying the image selected by the user works:
selectedImage = data.getData(); ImageView im = (ImageView) findViewById(R.id.view); im.setImageURI(selectedImage);
But when saving the image the user picked, it crashes here (found by debugger):
...
File externalStorageFile = new File(dir, finalName);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
//Error
resourceImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
byte b[] = bytes.toByteArray();
try {
...
Also, is bitmap the only way you can save images in Android?
Check this Links for Sample. If the Selected images from Gallery shows Bitmap out of range exception you need to Decode image.
Scale Image to screen Size….
Picking Image from gallery and Decode it…….