ActivityNotFoundException: No Activity found to handle Intent
来源:互联网 发布:早教管理软件 编辑:程序博客网 时间:2024/06/16 17:25
问题:
在android4.1系统上打开本地的PDF文件报错:android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] dat=file:///storage/sdcard0/DCIM/Camera/00746145.pdf typ=application/pdf flg=0x10000000 }
原因:
手机上没有支持打开PDF文件的应用
解决办法:
用try、catch处理异常当手机没有可用的应用时提示用户。
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File(path));
intent.setDataAndType(uri, "application/pdf");
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
MyToast.showToast_w(instance, "没有支持PDF文件打开的应用");
}
- ActivityNotFoundException: No Activity found to handle Intent
- ActivityNotFoundException: No Activity found to handle Intent
- ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- 隐试意图:ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- 解决ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- android.content.ActivityNotFoundException: No Activity found to handle Intent {
- android.content.ActivityNotFoundException: No Activity found to handle Intent
- ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.a
- ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUM
- android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.a
- 【Java】String、StringBuilder与StringBuffer
- Android--RxAndroid
- 常见的:Before和:After伪元素
- fdisk详解
- activiti升级至5.21.0需要添加的jar包
- ActivityNotFoundException: No Activity found to handle Intent
- apache下的BeanUtils和PropertyUtils的一个不同
- Android Studio 导入ViewpagerIndicator
- windows下获取github的paf.js
- dd命令详解
- mongodb分片集群的管理命令集合
- jquery 给对面添加属性和值
- js菜单自适应的实现
- RHEL3:使用rdesktop远程控制windows