user1005585
user1005585

Reputation: 285

Reading file from C drive from Android Emulator

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.

Upvotes: 3

Views: 2215

Answers (3)

Ishay Peled
Ishay Peled

Reputation: 2868

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

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006549

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.

Upvotes: 3

trinityalps
trinityalps

Reputation: 397

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.

Upvotes: 2

Related Questions