2017-10-21 112 views
1

这是一个问题,但我没有解决它使用该解决方案。 这里是我的代码排除谷歌驱动器选项浏览文件通过意图在Android

Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
Uri uri = Uri.parse(Environment.getDownloadCacheDirectory().getPath().toString()); 
intent.setDataAndType(uri,"*/*"); 
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); 
intent.addCategory(Intent.CATEGORY_OPENABLE); 
try { 
    startActivityForResult(Intent.createChooser(intent, "SELECT FILE"), commonUtilities.FILE_REQUEST_CODE); 
} catch (ActivityNotFoundException e) { 
} 

仍然谷歌驱动器选项在那里。我只是不想显示谷歌驱动器选项。

我怎样才能得到那个帮助我。在此感谢

+0

'Intent.EXTRA_LOCAL_ONLY'该怎么办? – greenapps

+0

哪种解决方案?如果你引用了simething,请提供一个链接。 – greenapps

+0

我使用'intent.putExtra(Intent.EXTRA_LOCAL_ONLY,true);'从[https://stackoverflow.com/questions/34310167/how-to-restrict-google-drive-option-from-not-appearing-while-选择文件或我]没有工作 – manjari

回答

0

我只是想不显示谷歌驱动器选项。

什么想要的并不重要。你的用户想要的是重要的。您的部分用户可能希望从Google云端硬盘,本地网络上的文件服务器以及他们在其设备上配置的其他地方获取支持ACTION_GET_CONTENT的内容。

除此之外,一般来说,您无法控制ACTION_GET_CONTENT向用户提供的选项。

因此,如果您不希望Google云端硬盘作为选项出现,请不要使用ACTION_GET_CONTENT(或ACTION_OPEN_DOCUMENT,ACTION_CREATE_DOCUMENT等)。做其他事情,比如整合一个file-picker library

+0

好的。谢谢。 – manjari

相关问题