【发布时间】:2015-12-08 12:37:22
【问题描述】:
我正在运行context.startActivity(intent);,我的意图如下所示:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(Uri.parse(uri), mimeType);
此时的uri是一个字符串http://remote.server.path/photo-12212324324.jpg
mimeType 是image/jpeg
这是一个异常示例。
12-07 20:48:55.934: I/ActivityManager(633): START u0 {act=android.intent.action.VIEW dat=http: typ=image/jpeg flg=0x1} from pid 1414
12-07 20:48:55.964: W/dalvikvm(1414): threadid=1: thread exiting with uncaught exception (group=0x40cb5ba0)
12-07 20:48:56.034: E/AndroidRuntime(1414): FATAL EXCEPTION: main
12-07 20:48:56.034: E/AndroidRuntime(1414): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http: typ=image/jpeg flg=0x1 }
12-07 20:48:56.034: E/AndroidRuntime(1414): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1760)
12-07 20:48:56.034: E/AndroidRuntime(1414): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1555)
12-07 20:48:56.034: E/AndroidRuntime(1414): at android.app.Activity.startActivityForResult(Activity.java:3431)
这发生在至少两台设备上,其中一台是三星 Galaxy S5,因此,我怀疑没有应用程序来处理该意图,因为用户至少会安装三星图库应用程序。我知道我可以处理异常并显示错误,但这并不是真正的修复..
【问题讨论】:
-
也许这会对你有所帮助:stackoverflow.com/questions/5882656/…
-
看到了,没有帮助。不过还是谢谢!