Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 指定“我的文件”的开始位置_Java_Android_Android Studio_Samsung Mobile - Fatal编程技术网

Java 指定“我的文件”的开始位置

Java 指定“我的文件”的开始位置,java,android,android-studio,samsung-mobile,Java,Android,Android Studio,Samsung Mobile,使用以下代码,我可以打开三星的文件浏览器: Intent samsungIntent= new Intent("com.sec.android.app.myfiles.PICK_DATA"); samsungIntent.putExtra("CONTENT_TYPE", "*/*"); samsungIntent.addCategory(Intent.CATEGORY_DEFAULT); startActivityForResult(samsungIntent, 123); 我尝试了以下方法打

使用以下代码,我可以打开三星的文件浏览器:

Intent samsungIntent= new Intent("com.sec.android.app.myfiles.PICK_DATA");
samsungIntent.putExtra("CONTENT_TYPE", "*/*");
samsungIntent.addCategory(Intent.CATEGORY_DEFAULT);
startActivityForResult(samsungIntent, 123);
我尝试了以下方法打开特定位置:

File root = new File( Environment.getExternalStorageDirectory( ).getPath( ) + "/myFolder" );
Uri uri = Uri.fromFile(root);
samsungIntent.setData(uri);
我在新活动中收到以下消息:

与此操作关联的所有应用都已关闭、阻止或删除 未安装

是否可以指定文件浏览器中“我的文件”的开始位置?

我发现以下问题没有答案:


您可以在samsungIntent中通过如下指定FOLDERPATH来设置并指定startlocation

Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");
intent.putExtra("CONTENT_TYPE", "*/*");    
intent.putExtra("FOLDERPATH", path);   
intent.addCategory(Intent.CATEGORY_DEFAULT);       
((Activity)Forms.Context).StartActivityForResult(intent, 0);