Samsung My Files资源管理器:从指定的文件夹中选择文件 [英] Samsung My Files explorer: Pick file from specified folder
本文介绍了Samsung My Files资源管理器:从指定的文件夹中选择文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码打开Samsung的我的文件"应用程序以选择文件...
I'm using the following code to open Samsung's My Files application to pick a file...
public void openFileBrowser( ) {
Intent intent = new Intent( "com.sec.android.app.myfiles.PICK_DATA" );
try {
startActivityForResult( intent, PICKFILE_RESULT_CODE );
} catch ( ActivityNotFoundException e ) {
e.printStackTrace( );
Log.log( Log.ERROR, TAG + "MyFiles is not installed !!" );
}
}
这将打开我的文件"应用程序,并允许用户通过它选择文件.
但是,我希望在设备的外部存储器上打开一个特定的文件夹...,然后让用户从中选择一个文件....
我试图通过实现...
this opens My Files application and lets user choose a file through it.
However, I wish to open a particular folder on device's external memory... and let user choose a file from there....
I tried achieving this by doing...
public void openFileBrowser( ) {
Intent intent = new Intent( "com.sec.android.app.myfiles.PICK_DATA" );
File root = new File( Environment.getExternalStorageDirectory( ).getPath( ) + "/MyFolder" );
Uri uri = Uri.fromFile( root );
intent.setData( uri );
try {
startActivityForResult( intent, PICKFILE_RESULT_CODE );
} catch ( ActivityNotFoundException e ) {
e.printStackTrace( );
Log.log( Log.ERROR, TAG + "MyFiles is not installed !!" );
}
}
但是我得到一个例外:
W/System.err(14682): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.sec.android.app.myfiles.PICK_DATA dat=file:///storage /emulated/0/MyFolder }
有人可以帮我吗?
谢谢!
Can someone please help me with this?
Thank you!
推荐答案
您可以通过指定如下所示的FOLDERPATH来设置在三星Intent中指定开始位置.
You can set specify the startlocation in samsung Intent by specifying the FOLDERPATH like below.
intent.putExtra("FOLDERPATH", path);
这篇关于Samsung My Files资源管理器:从指定的文件夹中选择文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文