Android XML reading issue (canRead() = false)

我的梦境 提交于 2019-12-11 15:12:16

问题


I've a problem with reading a XML file in my APP. I've tried multiple options but I'm getting error that read acces is false. I'm sure I'm using the correct path.

XML = new File(XML, "file.xml");
Log.i("XML", "Read access:" + XML.canRead());

This does return a false, I only need to read not to write (at least, not yet..).

System.getProperty(XML.getPath())

Returns null

I think there is a problem with the SD card (see other issue). But in my app I can open diffent folders except the XML file in the last folder.

I've added the correct permission to the manifest file.

Any help is very much appreciated. Thank you.

Edit: File path:

File f = new File(Environment.getExternalStorageDirectory().toString() + File.separator + "external_sd" + File.separator + "app" + File.separator + "Games" + File.separator + "Version_1" );

I've no problem with opening the folders. In my last folder there wil be a xml which can't be opened.

I'm using part of the path in other parts of the APP and there it works..

Also the code XML.exists() returns false...


回答1:


Was related to to other issue, that one also solved this issue

all thanks for the help..



来源:https://stackoverflow.com/questions/12973354/android-xml-reading-issue-canread-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!