onActivityResult not working after taken photo in Moto G - android

private void captureImage() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST);
}
/*
* Here we store the file url as it will be null after returning from camera
* app
*/
#Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// save file url in bundle as it will be null on scren orientation
// changes
outState.putParcelable("file_uri", fileUri);
}
#Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// get the file url
fileUri = savedInstanceState.getParcelable("file_uri");
}
/*
* Recording video
*/
/**
* Receiving activity result method will be called after closing the camera
* */
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// if the result is capturing Image
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST)
{
if (resultCode == RESULT_OK)
{
// successfully captured the image
// display it in image view
this.runOnUiThread(new Runnable() {
#Override
public void run() {
// TODO Auto-generated method stub
previewCapturedImage();
}
});
}
else if (resultCode == RESULT_CANCELED)
{
// user cancelled Image capture
Toast.makeText(getApplicationContext(),"User cancelled image capture", Toast.LENGTH_SHORT).show();
}
else
{
// failed to capture image
Toast.makeText(getApplicationContext(),"Sorry! Failed to capture image", Toast.LENGTH_SHORT).show();
}
}
}
this code is working on Google Nexus 4.4.4, but this same code is not working on Moto G 4.4.4.
I also used debugger but in the Moto G onActivityResult is not called.

Use this code:
ImageView profile=(ImageView)findviewById(R.id.imageview);
Intent i = new Intent(
Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, code);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == code) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
try {
bmp = BitmapFactory.decodeStream(getContentResolver()
.openInputStream(selectedImage));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
profile.setImageBitmap(bmp);
}
}
}

For working on all devices you don't have to put Extra in intent, and you need to get the path of image inside OnActivityResult method, Example:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode==CAMERA_REQUEST) {
if (resultCode == RESULT_OK) {
if (data.hasExtra("data")) {
// retrieve the bitmap from the intent
bitmap = (Bitmap) data.getExtras().get("data");
Cursor cursor = getActivity().getContentResolver().query(Media.EXTERNAL_CONTENT_URI,new String[] {
Media.DATA,
Media.DATE_ADDED,
MediaStore.Images.ImageColumns.ORIENTATION },
Media.DATE_ADDED, null, "date_added ASC");
if (cursor != null && cursor.moveToFirst()) {
do {
Uri uri = Uri.parse(cursor.getString(cursor.getColumnIndex(Media.DATA)));
selectedImagePath = uri.toString();
} while (cursor.moveToNext());
cursor.close();
}
Log.e("path of the image from camera ====> ",selectedImagePath);
public void callCamera() {
//access to camara
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}

Related

Get Image from the Gallery and Show in ImageView

I need to get an image from the gallery on a button click and show it into the imageview.
I am doing it in the following way:
btn_image_button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
getImageFromAlbum();
}
});
The method Definition is as:
private void getImageFromAlbum(){
try{
Intent i = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}catch(Exception exp){
Log.i("Error",exp.toString());
}
}
The activity result method is
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
try {
bmp = getBitmapFromUri(selectedImage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
image_view.setImageBitmap(bmp);
//to know about the selected image width and height
Toast.makeText(MainActivity.this, image_view.getDrawable().getIntrinsicWidth()+" & "+image_view.getDrawable().getIntrinsicHeight(), Toast.LENGTH_SHORT).show();
}
}
The Problem
The problem I am facing is when the image resolution is high suppose that if the image size is of 5mp to 13mp. It won't loads up and show up into the image view.
But the images with the low width and height are successfully loading into the image view!
Can somebody tell me any issues with the code and what I am doing wrong? I just want to import the camera images from the gallery and show them in the image view!
you can try this.
paste this code in your button click event.
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, RESULT_LOAD_IMG);
and below code is your on activity result
#Override
protected void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
if (resultCode == RESULT_OK) {
try {
final Uri imageUri = data.getData();
final InputStream imageStream = getContentResolver().openInputStream(imageUri);
final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
image_view.setImageBitmap(selectedImage);
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(PostImage.this, "Something went wrong", Toast.LENGTH_LONG).show();
}
}else {
Toast.makeText(PostImage.this, "You haven't picked Image",Toast.LENGTH_LONG).show();
}
}
I hope it is helpful for you.
I use this code:
This code used to start gallery activity.
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, GALLERY_REQUEST);
And get the result in:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == Activity.RESULT_OK)
switch (requestCode){
case GALLERY_REQUEST:
Uri selectedImage = data.getData();
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage);
carImage.setImageBitmap(bitmap);
} catch (IOException e) {
Log.i("TAG", "Some exception " + e);
}
break;
}
}
And don't forget to declare permission in AndroidManifest.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Because OnActivityResult method is deprecated, proper way nowadays with AndroidX Activity, is Activity Result APIs, and that recommended way, see docs
"registerForActivityResult() takes an ActivityResultContract and an ActivityResultCallback and returns an ActivityResultLauncher which you’ll use to launch the other activity."
ActivityResultLauncher<String> mGetContent = registerForActivityResult(new ActivityResultContracts.GetContent(),
new ActivityResultCallback<Uri>() {
#Override
public void onActivityResult(Uri uri) {
previewImage.setImageURI(uri);
}
});
And simply call
mGetContent.launch("image/*");
when needed.
startActivityForResult() is deprecated. Android introduced Activity Result Api for same purpose.
This is how to implement Activity Result
ActivityResultLauncher<Intent> imagePickerActivityResult = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
#Override
public void onActivityResult(ActivityResult result) {
if (result != null) {
Uri imageUri = result.getData().getData();
Glide.with(this)
.load(imageUri)
.into(R.id.profileImageView);
}
}
}
);
Call above code by calling launch() with intent
Intent galleryIntent = new Intent(Intent.ACTION_PICK);
galleryIntent.setType("image/*");
imagePickerActivityResult.launch(galleryIntent);
I try all the solutions above but they don't work for me . I saw a code from tutorialspoint website and it works for me very well this is the code :
final int PICK_IMAGE = 100;
Button button = findViewById(R.id.button33);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent gallery = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(gallery, PICK_IMAGE);
}
});
#Override
protected void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
Uri imageUri;
ImageView imageView = findViewById(R.id.image_main_galary);
if (resultCode == RESULT_OK && reqCode == 100){
imageUri = data.getData();
imageView.setImageURI(imageUri);
}
}
the most important issue : don't forget PERMISSION :
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

capture image from camera and do fixed cropping in android

I am trying to crop the image as we are doing in facebook. I have used this link in my app: https://github.com/oginotihiro/cropview This is working fine for me.But here when I click on a button, its directly going to gallery and cropping the selected image.Instead of that I want to open camera in my device and click the image and I want to do cropping.How can I do this?Can someone help me.
I have tried this code.But I am not able to implement.
imageBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
reset();
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_PICK);
}
});
doneBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
final ProgressDialog dialog = ProgressDialog.show(StudentDetails.this, null, "Please wait…", true, false);
cropView.setVisibility(View.GONE);
layout4.setVisibility(View.GONE);
resultIv.setVisibility(View.VISIBLE);
layout3.setVisibility(View.GONE);
layoutUpload.setVisibility(View.VISIBLE);
// editTextName.setVisibility(View.GONE);
buttonUpload.setVisibility(View.VISIBLE);
new Thread() {
public void run() {
croppedBitmap = cropView.getOutput();
runOnUiThread(new Runnable() {
#Override
public void run() {
// cropped image set
resultIv.setImageBitmap(croppedBitmap);
}
});
Uri destination = Uri.fromFile(new File(getCacheDir(), "cropped"));
CropUtil.saveOutput(StudentDetails.this, destination, croppedBitmap, 1);
runOnUiThread(new Runnable() {
#Override
public void run() {
dialog.dismiss();
}
});
}
}.start();
}
});
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == REQUEST_PICK) {
filePath = data.getData();
cropView.setVisibility(View.VISIBLE);
layoutImage.setVisibility(View.VISIBLE);
layout3.setVisibility(View.GONE);
layout4.setVisibility(View.VISIBLE);
textNameVal.setVisibility(View.GONE);
text1.setVisibility(View.GONE);
buttonUpload.setVisibility(View.GONE);
int x=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
int y=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
cropView.of(filePath).withAspect(x,y).initialize(StudentDetails.this);
}
}
Step1: Start to open gallery
Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
Step2: Get Image from gallery:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.imgView);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
With your case, you can crop at the onActivityResult method.
It will help you.
With camera:
Step1: Open camera
/*
* Capturing Camera Image will lauch camera app requrest image capture
*/
private void captureImage() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
// start the image capture Intent
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}
Step2: Get image from camera.
/**
* Receiving activity result method will be called after closing the camera
* */
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// if the result is capturing Image
if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// successfully captured the image
// display it in image view
previewCapturedImage();
} else if (resultCode == RESULT_CANCELED) {
// user cancelled Image capture
Toast.makeText(getApplicationContext(),
"User cancelled image capture", Toast.LENGTH_SHORT)
.show();
} else {
// failed to capture image
Toast.makeText(getApplicationContext(),
"Sorry! Failed to capture image", Toast.LENGTH_SHORT)
.show();
}
}
}
Step3: Add permission
<!-- Accessing camera hardware -->
<uses-feature android:name="android.hardware.camera" />

Camera Intent - Storage full

When I press the photoButton, the default Camera App starts.
My Problem is that it says, that the storage is full.
When I start the Camera app seperate the Error didn't show up.
Here is the Code for the Camera Intent:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case CAMERA_PIC_REQUEST: {
try {
Bitmap image = (Bitmap) data.getExtras().get("data");
ImageView imageView = (ImageView) findViewById(R.id.taskPhotoImage);
imageView.setImageBitmap(image);
} catch (NullPointerException e) {
e.printStackTrace();
}
}
case REQ_CODE_SPEECH_INPUT: {
if (resultCode == RESULT_OK && null != data) {
ArrayList<String> result = data
.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
textField.setText(textField.getText() + " " + result.get(0));
}
break;
}
}
}
in onCreate() method:
photoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
}
});
I don't know if it's a problem within the code. But it looks like that something goes wrong
Kind Regards
Try This:-
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// After camera screen this code will excuted
if (requestCode == CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
output.setText("Video File : " +data.getData());
// Video captured and saved to fileUri specified in the Intent
Toast.makeText(this, "Video saved to:" + data.getData(), Toast.LENGTH_LONG).show();
} else if (resultCode == RESULT_CANCELED) {
output.setText("User cancelled the video capture.");
// User cancelled the video capture
Toast.makeText(this, "User cancelled the video capture.",
Toast.LENGTH_LONG).show();
} else {
output.setText("Video capture failed.");
// Video capture failed, advise user
Toast.makeText(this, "Video capture failed.",
Toast.LENGTH_LONG).show();
}
}
}
try this
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PICTURE:
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageUri;
getContentResolver().notifyChange(selectedImage, null);
ImageView imageView = (ImageView) findViewById(R.id.ImageView);
ContentResolver cr = getContentResolver();
Bitmap bitmap;
try {
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
imageView.setImageBitmap(bitmap);
Toast.makeText(this, selectedImage.toString(),
Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT)
.show();
Log.e("Camera", e.toString());
}
}
}}
And if you want camera intent
private static final int TAKE_PICTURE = 1;
private Uri imageUri;
public void takePhoto(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), "picture.jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
}

Why the camera intent do not return after photo taken

I am trying to write a function that allow the user select to open a camera , then when the user take one photo, it return , get the scaled photo and set that bitmap on the imageView. The problem is either the default camera or other camera apps on the market will not fire the return case after I take a pic , how to fix that ? Thanks
Take picture button:
takePic.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
File tempFile;
try {
tempFile = File.createTempFile("my_app", ".jpg");
fileName = tempFile.getAbsolutePath();
Uri uri = Uri.fromFile(tempFile);
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
After intent result
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_GET_IMAGE_ALBUM && resultCode == RESULT_OK) {
Uri selectedImage = data.getData();
Intent shareIntent = new Intent(this, SharePicForm.class);
shareIntent.putExtra("photo", Utility.getImagePath(selectedImage,this));
startActivity(shareIntent);
} else if ( requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Log.d("test1","return");
Intent shareIntent = new Intent(this, SharePicForm.class);
shareIntent.putExtra("photo", data.getStringExtra(MediaStore.EXTRA_OUTPUT));
startActivity(shareIntent);
}
}

Using intent to use Camera in Android

I am using the following code to use camera by using intent.
In the parameter of intent I am passing android.provider.MediaStore.ACTION_IMAGE_CAPTURE.
It is able to open the camera.
But the problem is that it stops unexpectedly.
The problem is that it gives null pointer exception on OnActivityResults.
I have used the below code:
public class demo extends Activity {
Button ButtonClick;
int CAMERA_PIC_REQUEST = 2;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ButtonClick =(Button) findViewById(R.id.Camera);
ButtonClick.setOnClickListener(new OnClickListener (){
#Override
public void onClick(View view)
{
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
// request code
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
}
});
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if( requestCode == CAMERA_PIC_REQUEST)
{
// data.getExtras()
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
ImageView image =(ImageView) findViewById(R.id.PhotoCaptured);
image.setImageBitmap(thumbnail);
}
else
{
Toast.makeText(demo.this, "Picture NOt taken", Toast.LENGTH_LONG);
}
super.onActivityResult(requestCode, resultCode, data);
}
}
Can anyone help me to solve this problem?
Try request code 1337.
startActivityForResult(cameraIntent , 1337);
This how I use it
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, 1337);
do you have the following declarations in your manifest ?:
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.autofocus" />
??
I used to do the same...
here is my call to intent:
File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
intent.putExtra( MediaStore.EXTRA_VIDEO_QUALITY,1);
the only slight difference between my and your code - I have file path in URI sending among call
I have used the following code and it worked!
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode,
final Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
im.setImageDrawable(null);
im.destroyDrawingCache();
Bundle extras = data.getExtras();
Bitmap imagebitmap = (Bitmap) extras.get("data");
im.setImageBitmap(imagebitmap);
}
}
Using intent to use Camera in Android
##
Uri imageUri;
1:-
TextView camera = (TextView)findViewById(R.id.camera);
camera.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
final Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory(), new Date().getTime() + "myPic.jpg");
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(cameraIntent, IMAGE_CAMERA_REQUEST);}
2:-
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
if (requestCode == IMAGE_CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageUri;
getActivity().getContentResolver().notifyChange(selectedImage, null);
ContentResolver contentResolver = getActivity().getContentResolver();
Bitmap bitmap;
try {
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(contentResolver, selectedImage);
imageDialog(bitmap);
} catch (Exception e) {
Log.e("Camera", e.toString());
}
}
}
}}
I hope it's working for you.

Categories

Resources