/**
* 获取一个用于打开PPT文件的intent
*
* @param param
* @return
*/
private static Intent getPptFileIntent(String param) {
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(param));
intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
return intent;
}
/**
* 获取一个用于打开Excel文件的intent
*
* @param param
* @return
*/
private static Intent getExcelFileIntent(String param) {
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(param));
intent.setDataAndType(uri, "application/vnd.ms-excel");
return intent;
}
/**
* 获取一个用于打开Word文件的intent
*
* @param param
* @return
*/
private static Intent getWordFileIntent(String param) {
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(param));
intent.setDataAndType(uri, "application/msword");
return intent;
}
Intent打开ppt、word、Excel
最新推荐文章于 2024-04-16 03:23:39 发布