开发者

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

My button's onc开发者_如何学Pythonlick 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜