标签:
要同时设置data和type的话只能用函数setDataAndType
private void installApk(File file) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); // intent.setData(Uri.fromFile(file)); // intent.setType("application/vnd.android.package-archive"); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); startActivity(intent); }
标签:
原文地址:http://www.cnblogs.com/linson0116/p/5814772.html