开发者

Viewing an image using the activity manager

开发者 https://www.devze.com 2023-01-31 01:10 出处:网络
I\'m writing an automation script to check my new photo gallery application. I\'ve been trying to get am to show images using the ACTION_VIEW intent but for some reason it doesn\'t work. Here\'s what

I'm writing an automation script to check my new photo gallery application. I've been trying to get am to show images using the ACTION_VIEW intent but for some reason it doesn't work. Here's what I've tried:

adb shell am start -a android.intent.action.VIEW -d "file:///sdcard/Android/test.jpg"

or

adb shell am start "file:///sdcard/Android/test.jpg"

however, both commands fail with the follo开发者_Python百科wing error:

Starting: Intent { act=android.intent.action.VIEW dat=/sdcard/Android/test.jpg } Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=/sdcard/Android/test.jpg flg=0x10000000 }

Any ideas?

Thanks.


You need a MIME type on that Intent via the -t switch. See this SO question and answer for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消