问题描述
我想开始一个intentchooser它可以返回任何类型的文件。下面code工作与通常的文件探险家(ES,天文等),但不与内置的三星我的文件浏览器。
意向选择文件=新的意图(Intent.ACTION_GET_CONTENT);
selectFile.setType(文件/ *);
startActivityForResult(Intent.createChooser(选择文件,选择文件),SELECT_FILE);
有谁知道如何处理,三星浏览器?我试图用意向选择文件=新的意向书(com.sec.android.app.myfiles.PICK_DATA),但它似乎并没有工作。
任何想法?谢谢你。
更新:我用这个code
意向选择文件=新的意图();
selectFile.setAction(com.sec.android.app.myfiles.PICK_DATA);
startActivityForResult(选择文件,SELECT_FILE);
但我得到这个错误:FORWARD_RESULT_FLAG使用,同时也要求结果。任何人都知道这是什么意思?
意图samsungIntent =新意图();
samsungIntent.setAction(com.sec.android.app.myfiles.PICK_DATA);
samsungIntent.putExtra(CONTENT_TYPE,* / *);
从改变到的setType putExtra的伎俩。
I would like to start an intentchooser which can return any kind of file. The following code works with the usual file explorers (ES, Astro, etc.) but not with the built-in samsung My Files explorer.
Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT);
selectFile.setType("file/*");
startActivityForResult(Intent.createChooser(selectFile, "Select File"), SELECT_FILE);
Does anyone know how to handle that samsung explorer? I tried to use Intent selectFile = new Intent( "com.sec.android.app.myfiles.PICK_DATA") but it doesn't seem to work.
Any ideas? Thanks.
Update:I used this code
Intent selectFile = new Intent();
selectFile.setAction("com.sec.android.app.myfiles.PICK_DATA");
startActivityForResult(selectFile, SELECT_FILE);
but I get this error: FORWARD_RESULT_FLAG used while also requesting a result. Anyone know what does this mean?
Intent samsungIntent = new Intent();
samsungIntent.setAction("com.sec.android.app.myfiles.PICK_DATA");
samsungIntent.putExtra("CONTENT_TYPE", "*/*");
Changing from setType to putExtra does the trick.
这篇关于三星我的文件浏览器:选择文件的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!