Android Emulator: Write file to local file system?
I am wondering if its possible to get my android application to save a file to a windows file system or is there 开发者_如何转开发a simple work around I can adopt?
I am using the android emulator to do tests and I need it to write to the local hard drive so I can do further processing on the file.
I hope this is possible and I appreciate any help.
You can save a file to the emulator's SD card and then make adb pull
.
As far as I am aware the answer is no, you can save the file to the SD card or to the application's storage and use the File Explorer tool (Window -> Show View -> Other -> File Explorer) in Eclipse to extract that file to your machine or use the adb pull
method
If you are using conventional SDK the answer is (probably) no. If you look at ~/.android/avd you will see that whatever your emulator is doing is stored into *.img files. Said that you can create some sort of service running on the localhost and connect to that from your app. This will actually better resemble real-life scenario
Based on your reaction to @pixie answer it looks like I misunderstood your question. Indeed you can simply use your Eclipse DDMS perspective to navigate to the file and then "pull" or "push" a file. You can't just do it programmatically from withing your app
精彩评论