How do I access full-size images taken by the camera from Android Intent?… here is a solution to the problem.
How do I access full-size images taken by the camera from Android Intent?
The onclick listener for my button is as follows:
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
}
});
The result is processed as follows:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_PIC_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
ImageView Preview = (ImageView) findViewById(R.id.PreviewImage1);
Preview.setImageBitmap(thumbnail);
Preview.setVisibility(View.VISIBLE);
}
}
}
I
can use thumbnails, but how do I access the full image for some work? I want to avoid saving files if possible.
Solution
Here’s a working example: http://achorniy.wordpress.com/2010/04/26/howto-launch-android-camera-using-intents/
You can’t get a full-size image without saving to a file. This is also not a good idea, because having such a large bitmap in memory can quickly cause an out-of-memory exception.