我想用我的应用程序打开一个PPT文件。如何检查设备上是否有可以显示这些文件的应用程序,以及如何启动该应用程序?
发布于 2012-09-03 18:47:22
试试这样的东西。尚未尝试,但可能会起作用
final Uri uri = Uri.fromFile(file);
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
if(list.size() > 0)
startActivity(context, intent);发布于 2014-02-28 05:18:22
File file = new File("path_to_the_file.ppt");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),"application/vnd.ms-powerpoint");
startActivity(intent);试试这个
https://stackoverflow.com/questions/12246186
复制相似问题