【文件属性】:
文件名称:Android中调用系统所装的软件打开文件
文件大小:15KB
文件格式:DOCX
更新时间:2015-07-06 10:23:04
Android中打开文件
/**
* 打开文件
* @param file
*/
private void openFile(File file){
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//设置intent的Action属性
intent.setAction(Intent.ACTION_VIEW);
//获取文件file的MIME类型
String type = getMIMEType(file);
//设置intent的data和Type属性。
intent.setDataAndType(/*uri*/Uri.fromFile(file), type);
//跳转
startActivity(intent);
}
网友评论
- 不错,项目中用到了,很不错,学习了
- 很好的资源。。。学习了
- 有些用 参考了一下 感谢分享
- 很不错,,刚好用到
- 很好,有用的
- 一个word文档,不是工程文件,而且word应该是从其他地方拷贝过来的,没太大参考价值。
- 感觉简单了一下,没什么实用
- 恩,不错,可以用
- 这网上好多啊~还以为你这不一样了结果还是复制粘贴流的 可惜我那1分了、、、、、
- 恩,不错,可以用
- 很好 代码粘贴过来就可以用 谢谢了