当前位置: 代码迷 >> Android >> 设计一个button,点击打开指定的SD卡文件夹,如何破
  详细解决方案

设计一个button,点击打开指定的SD卡文件夹,如何破

热度:2   发布时间:2016-05-01 10:39:14.0
设计一个button,点击打开指定的SD卡文件夹,怎么破
如题,求大神指导?google了一圈也没找到答案

------解决方案--------------------
引用:
如题,求大神指导?google了一圈也没找到答案



Intent intent = new Intent();
String videoPath = path;// 指定路径
File file = new File(videoPath);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
intent.setAction("com.xxx.xxx");//"com.xxx.xxx" 为文件管理器包名
try {
    startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}


不知道是否满足你想达到的效果
------解决方案--------------------
引用:
path路径怎么写啊?
path = "mnt/sdcard/Flight photo/";这样可以吗?
我运行之后报错,应该是路径写的格式不对吧?
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.mifileexplorer dat=file:///mnt/sdcard/Flight photo }
貌似是"/mnt/sdcard/Flight photo/"
------解决方案--------------------
把你的联系方式留一下,我发给你一个代码参考一下,之前自己写的找不到了,这个是我以前参考用的

------解决方案--------------------
引用:
Quote: 引用:

把你的联系方式留一下,我发给你一个代码参考一下,之前自己写的找不到了,这个是我以前参考用的

谢谢,[email protected]!!!


发给你了!
  相关解决方案