android - 尝试使用 Intent 在android中打开特定文件夹

标签 android android-intent

<分区>

我想在 android 中打开一个特定的文件夹?是否可以打开一个特定的文件夹????这是我正在使用的代码

    config=(Button)findViewById(R.id.btn_cf);

      config.setOnClickListener(new View.OnClickListener() 
      {         
            @Override
            public void onClick(View v)
            { 

            Intent intent = new Intent("Intent.ACTION_GET_CONTENT"); 
             Uri uri = Uri.parse("mnt/sdcard/myfiles/allfiles/download"); 
            intent.setDataAndType(uri, "*/*"); 
            startActivity(Intent.createChooser(intent, "download"));


            }
       });

最佳答案

有效:

Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(selectedUri, "resource/folder");
startActivity(intent); 

写得愉快 :)

编辑: 如果当前的解决方案对您没有帮助,那么这些文件/目录选择器库可能会有所帮助: https://android-arsenal.com/tag/35

关于android - 尝试使用 Intent 在android中打开特定文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21544331/

相关文章:

android - 如何在android中的不同布局中动态添加按钮?

android - 启动 ListAdapter 抛出 NullPointerException

java - Android Activity 类不存在

用于打开 Waze 和 Google map 的 Android Intent

android - 从搜索图像的内容 URI 获取绝对文件路径

android - 为 Froyo 2.2 Droid 添加启动声音

android - 无法使用 PATH 环境变量找到 javac.exe

android - Wifimanager如何连接WEP/WAP网络

android - 在某些设备中抛出 java.lang.NoClassDefFoundError,但不是全部

android - 如何使用 intent 预加载 AdMob 插页式广告并发送到另一个 android Activity