has stopped unexceptedly\"" />
开发者

"The application .... has stopped unexceptedly" Reading Files

开发者 https://www.devze.com 2023-02-21 23:00 出处:网络
I have an xml in /data//files/file.xml and another txt file in same location. I am not able to read those开发者_JAVA百科 files. It throws me error \"The application <...> has stopped unexceptedly\"

I have an xml in /data//files/file.xml and another txt file in same location. I am not able to read those开发者_JAVA百科 files. It throws me error "The application <...> has stopped unexceptedly" with "Force Close" button and the application quits.

Can anyone help me know the cause of it ? I am really stuck up.


You cant access Ur data file like that.

follow these steps

  1. Create a folder in res folder with name as raw . and save your XML file in raw folder.

  2. then use

      InputStream inp = Context.getResources().openRawResource(R.raw.datafile);
    

u will get InputStream reference. where u can proceed further with it as u need.


Thanks Friends,

I found a solution and now could read the file stored in files folder. Thanks a lot for your help and support.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号