How to find and use the required Intent/Activity

While implementing capturing and cropping a photo I was getting frustrated. On my Galaxy Note 2 (4.4.2) the behaviour was different compared to the Genymotion Simulator of the Note 2 (4.3). Then I discovered by accident that in the contacts app on the simulator cropping works. So I began to search which Activity this could be to find out how to set the parameter. I already know that the Action has to be used.

With the help of the Android Debug Bridge (adb)

adb shell dumpsys package > d:\test.txt

I can pipe system information of the connected device into a file. For more information about the Android Debug Bridge visit the official documentation. There for the sumulated Note 2 I got

MIME Typed Actions:
    52a70a98 filter 52a70b2c
    52a6ce48 filter 52a2c644
    52a86a2c filter 52a86b98

which lists as an Activity which can crop an image.

For the real Note 2 I got

    42eaaeb0 filter 42eab990
    42738108 filter 42cfedd8

But how to call that via an Intent? One can look into the code of CropImage via e.g. Grepcode (search for CropImage and choose the 4.3 version) to see how to set the parameter of the Intent.

Another approach is to search for on e.g. GrepCode via "" on google. This will list some constant definitions but also e.g. which defines the Intent via the action “”`. Here we can see how to set the parameter of the Intent.

But as a lot of sources in the web correctly state, there is no build in crop Intent on all Android devices. See e.g. The CommonsBlog. So be careful when using Use a cropping library or provide a fallback when no cropping Activity is found.

Die Kommentarfunktion ist geschlossen.