i want to take a photo with the android camera like this:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
this.startActivityForResult(intent, Globals.REQUEST_CODE_CAMERA)
And to store it in an ImageView:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == Globals.REQUEST_CODE_CAMERA) {
if(resultCode == RESULT_OK) {
Bundle bundle = data.getExtras();
Bitmap bitmap = (Bitmap) bundle.get("data");
this.imageViewPhoto.setImageBitmap(bitmap);
}
}
}
My ImageView is configured like this:
<ImageView
android:id="@+id/nfcresult_imageview_photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:clickable="true"
android:contentDescription="@string/imageview_photo_description" />
It all works but the photo shown on the ImageView is much smaller than the photo taken by the camera. What i want to do is to have a small preview in my ImageView and to add an OnClickListener to the ImageView to open up a Dialog which shows the original photo with the original size and resolution. It cant be that hard to do it but i actually cant find out how.
To create the Dialog and to show the photo i do this:
ImageView clone = new ImageView(this);
clone.setImageBitmap(((BitmapDrawable)this.imageViewPhoto.getDrawable()).getBitmap());
DialogManager.showImageDialog(this, this.getResources().getString(R.string.title_photo), clone);
The showImageDialog:
public static void showImageDialog(Context context, String title, ImageView imageView) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setCancelable(false);
builder.setView(imageView);
builder.setPositiveButton(context.getResources().getString(R.string.button_back), new DialogInterface.OnClickListener() {
/**
*
*/
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
The dialog now shows the photo with the size of the photo stored in the imageView but i want to show the original photo with original size and original resolution but as i already said, the ImageView should show a smaller version of the original photo.
How can i achieve that?