当调用系统Intent时,以调用以下2种Intent出现:No Activity found to handle Intent出错提示时,主要的原因及解决办法:
1、访问浏览器:
Uri uri = uri.parse("www.google.com");
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
原因:网址前面未加http导致的,访问的网址必须是完整的网址,不能省略http。
2、访问地图:
Uri uri = Uri.parse("geo:39.82,116.46");
Intent intent1 = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent1);
原因:模拟器上没有查看地图的软件,因此会出错,真机上一般都有查看地图的软件,所以在真机上不会出错。
3、如果是启动SD卡里面的apk包安装,则需要加上"file://" + apk包的路径名字
一般写法:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + Environment.getExternalStorageDirectory().getAbsolutePath()+"/UpdateDemo.apk"),"application/vnd.android.package-archive");
startActivity(intent);
同时还需要对配置文件设置权限,使其能够获取写入SD卡的权限。
参考:http://blog.youkuaiyun.com/aminfo/article/details/7738346