SD卡访问API的Android的棒棒糖? [英] SD-Card access API Android for Lollipop?
问题描述
在此的其他问题。
<一个href=\"http://stackoverflow.com/questions/26744842/how-to-use-the-new-sd-card-access-api-$p$psented-for-lollipop\">How使用psented的棒棒糖新的SD卡访问API $ P $?
据解释了如何使用新的API来访问外部SD卡。
It is explained how to use the new API to access the "external SDCard".
但是,我怎么能知道结果的活动返回的实际目录?
But, how can I know the actual directory returned in the result activity?
我的意思是在功能上
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
if (resultCode == RESULT_OK) {
Uri treeUri = resultData.getData();
DocumentFile pickedDir = DocumentFile.fromTreeUri(this, treeUri);
......
......
我怎样才能得到实际的路径,其中乌里treeUri点?
How can I get the actual path where "Uri treeUri" points?
谢谢,
弗朗西斯。
Thanks, Francis.
推荐答案
使用
FileUtil.getFullPathFromTreeUri(treeUri, this)
从
<一个href=\"https://github.com/jeisfeld/Augendiagnose/blob/master/AugendiagnoseLib/src/de/jeisfeld/augendiagnoselib/util/imagefile/FileUtil.java\" rel=\"nofollow\">https://github.com/jeisfeld/Augendiagnose/blob/master/AugendiagnoseLib/src/de/jeisfeld/augendiagnoselib/util/imagefile/FileUtil.java
要得到完整的路径。使用单独的路径
to get the full path. Seperate the path using
final String[] seperated = treeUri.toString().split("\\/");
来获得当前目录名称。
to get the current dir name.
这篇关于SD卡访问API的Android的棒棒糖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!