Android使用文件管理器打开指定文件夹,浏览里面的内容
Android下可以打开一些文件,带有.doc 等后缀的文件网上一般都有解释,这个写一个使用文件管理器打开指定文件夹的
private void openAssignFolder(String path){ File file = new File(path); if(null==file || !file.exists()){ return; } Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "file/*"); try { startActivity(intent);// startActivity(Intent.createChooser(intent,"选择浏览工具")); } catch (ActivityNotFoundException e) { e.printStackTrace(); } }
| Intentintent=newIntent(Intent.ACTION_VIEW); |
打开图片文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开PDF文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开文本文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开音频文件 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
打开视频文件 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
打开CHM文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开apk文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开PPT文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开Excel文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
打开Word文件 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
如有问题可以发邮件到 friday_holiday@163.com进行讨论
更多相关文章
- android 向serverGet和Post请求的两种方式,android向server发送
- android使用webview加载flash文件
- 修改Android中strings.xml文件
- Android获取sd卡上的文件目录-日记
- PC上安装android market软件并提取apk文件
- 通过终端命令生成并在手机上运行dex文件
- Android Studio ——Android 使用Pull方法解析XML文件的方法