简体   繁体   中英

How do I access the full size image taken with the camera from an Android Intent?

My button's onclick listener 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);
      }

    });

And the result is handled 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 got the thumbnail working but how do I access the full image so that I can do some manipulations? I want to avoid saving the file if possible.

Here is a working example: http://achorniy.wordpress.com/2010/04/26/howto-launch-android-camera-using-intents/

Getting the full-sized image is not possible without saving to a file. Also it won't be a good idea, because having so big Bitmaps in memory will soon cause Out of memory exception.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM