3

I am trying out a test application on an Android emulator. I would like the app to write data to a file that is stored on my C drive. I have read and written data off Samba drives and webservices, but reading and writing to my local hard seems to be a puzzle. I tried filePath = "file:///C:/test/input/"; to point it as my parent folder, but the Emulator doesn't seem to recognize the directory, and I get a 'not found' error.

Any ideas will be appreciated. Thanks.

Jonathon Reinhart
  • 116,671
  • 27
  • 221
  • 298
user1005585
  • 265
  • 5
  • 17

3 Answers3

2

Given that you are using an android emulator I am guessing it is setting up some special folder to act as a proxy for the androids hard drive. Meaning that the android emulator doesn't understand what your C drive is and instead is looking in it's 'hard drive' for a file. Find out where the emulator puts files for android, it could be a temp folder, and store your file there.

Edit: Where is Android Emulator Internal Storage this question should help you find where the files should be stored and the naming conventions.

Community
  • 1
  • 1
trinityalps
  • 467
  • 4
  • 17
  • Great answer! +1 because I didn't know you can do that with the bundled emulator. I don't think it will help the author though, because he needs to access his external drive from the emulated device. Do you know of a way to do that? – Ishay Peled Jun 25 '15 at 19:45
  • I don't think that is what he needs to do.... If I understand it correctly it seems like he is just using his c drive because it's an emulator. If you wanted to access an external drive with android that is probably a different question altogether. – trinityalps Jun 25 '15 at 20:03
  • "I would like the app to write data to a file that is stored on my C drive" ? – Ishay Peled Jun 25 '15 at 20:08
  • "I have read and written data off Samba drives and webservices, but reading and writing to my local hard seems to be a puzzle." That line suggested to me that he was just trying to use a local hard drive, not any specific hard drive but just a local one, and not a cloud drive, but now I don't know! – trinityalps Jun 25 '15 at 20:10
2

I would like the app to write data to a file that is stored on my C drive.

That is not possible, unless that file is accessible via some server. The Android SDK emulator does not have access to the filesystem of the developer PC.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
0

If you don't care using genymotion emulator instead you can refer to this answer, pointing to this post, it has just what you need

Community
  • 1
  • 1
Ishay Peled
  • 2,600
  • 1
  • 19
  • 34