I’m trying to push an image to an AVD’s SD-Card and open it from the adb shell.
First step:
adb push test.jpg /sdcard/Pictures/test.jpg
The image is transferred successfully. But here is the first problem: When I try to open the image manually in the gallery, no image can be found. I have to reboot the emulator, after that I can see the image. Is there a way to open the image on the AVD without rebooting? Remounting the SD-Card is not possible (→ https://stackoverflow.com/a/2825608).
Second step is to open the image from adb shell. I tried these commands:
am start -t image/* /sdcard/Pictures/test.jpg -n com.android.gallery/com.android.camera.ViewImage
am start -t image/* file:///sdcard/Pictures/test.jpg -n com.android.gallery/com.android.camera.ViewImage
am start -t image/* file://sdcard/Pictures/test.jpg -n com.android.gallery/com.android.camera.ViewImage
The first one brings up this error message:
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] typ=image/* cmp=/sdcard/Pictures/test.jpg }
Error type 3
Error: Activity class {/sdcard/Pictures/test.jpg} does not exist.
The second/third will cause crashing the Camara-App:
Unfortunately, camera has stopped.
How can I open this image? Opening it manually works without any problem.
The device is an emulated Nexus 4 with Android 4.4.2.