Reputation: 173
I am trying to obtain the bitmap of the full size image resulting from an intent, with the following i only obtain de bitmap of the thumbnail.
//------- START CAMERA --------------
public void onClickBtn(View v) {
vibe.vibrate(100);
Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camera_intent, pic_id);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == pic_id) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
click_image_id.setImageBitmap(photo);
//------------------------------
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);
editor.putString("img", encoded);
editor.apply();
}
}
This is for SDK 34 with the following setup:
Android Studio Koala Feature Drop | 2024.1.2 Build #AI-241.18034.62.2412.12266719, built on August 22, 2024 Runtime version: 17.0.11+0--11852314 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10.0
Upvotes: 0
Views: 41