How to get result from activity without using onActivityResult

I am calling my camera to capture an image using the following intent:

Intent imageIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

      

Now if you are using startActivityForResult()

I can get the resulting data, i.e. the uri of the captured image, and then I can do some operations on that image in onActivityResult()

.

My question is, is there any other way to get this resulting data other than in onActivityResult()

.

+3


source to share


2 answers


My question is, is there any other way to get this resulting data other than in onActivityResult ().



No, sorry. The only way to get results from startActivityForResult()

starting an activity that you don't write is through onActivityResult()

.

+2


source


Yup to try this hack ...

1.You can query / listen to MediaStore and check the timestamp of the last picture.

2. Match the imaging timestamp with the camera start time. Activity, if the difference is very small, chances are very good that the user has taken an image with the camera operation you started.

Just adding this will only work when you want to select the image just clicked by the camera or the last image created in the system.



If you are only interested in the image captured by the camera, you have come to using the apis android camera.

The Android platform supports a variety of cameras and cameras, features available on devices that allow you to capture snapshots and videos in your applications.

For more information see here

0


source







All Articles