Downloading to & accessing /files directory

  • Replies:2
  • Answered
josh wynn
  • Forum posts: 4

Apr 7, 2012, 1:21:34 AM via Website

my apologies if this is explained elsewhere and i have not found the correct way to phrase the query...

i am updating an app i developed so that it downloads xml files it needs for content management. the files download successfully to the emulator but are not placed in the /files directory that openFileInput() is attempting to read from. i am admittedly unsure as to the proper overall solution here - app originally used packaged XML and was fed to an XMLPullParser - but i cant even get as far as attempting to parse new XML at present because my app cant find the new file sitting in /data/data/[myApp]/ and not /data/data/[myApp]/files and i cant figure out how to get it in there. the download doesnt work at all if i add that folder to path.

thank you anyone.

— modified on Apr 7, 2012, 1:22:22 AM

Reply
Jeremiah
  • Forum posts: 775

Apr 7, 2012, 7:15:18 AM via Website

Are you using openFileOutput to save the files when you download them? According to to the developer guide all you have to use is the filename in the fileinput and output stream.
http://developer.android.com/guide/topics/data/data-storage.html#filesInternal

— modified on Apr 7, 2012, 7:15:35 AM

josh wynn

Reply
josh wynn
  • Forum posts: 4

Apr 8, 2012, 2:02:33 PM via Website

no i was not - not in my Downloader class. and that solved the problem - thank you sir.

a tutorial/example i followed just used this

1FileOutputStream fos = new FileOutputStream(file);

which put the file in the app's root directory but not in any folder, not in the /files folder

— modified on Apr 8, 2012, 2:04:34 PM

Reply