与 iOS 不同,Android 本身不支持渲染 .doc 或 .ppt 文件。您正在寻找一个公共意图,允许您的应用程序重用其他应用程序的活动来显示这些文档类型。但这仅适用于安装了支持此 Intent 的应用程序的手机。
http://developer.android.com/guide/topics/intents/intents-filters.html http://developer.android.com/guide/topics/intents/intents-filters.html
或者如果您安装了某些应用程序,则使用此 Intent:
//Uri uri = Uri.parse("file://"+file.getAbsolutePath());
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
String type = "application/msword";
intent.setDataAndType(Uri.fromFile(file), type);
startActivity(intent);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)