简体   繁体   中英

Reading file from External Storage of Android SDK Emulator

i am new bie in android, I am developing an application in Android, and i used some ready made libs, now there is browse option, and when i do browse it gives the place of /mnt/sdcard, it is basiacally a file reader, if i use this app in mobile then i can browse my memory card, but there even 500MB card have been configured in emulator, i dont know where to place the files so i can access in my Emulator's app, i am expecting, there will be a path like C:\\Program Files (x86)\\Android\\android-sdk\\SOMEFolder where i can place my files using computer and can access in my emulator. Attached an image of my emulator 在此输入图像描述

i dont know where to place the files so i can access in my Emulator's app ...

You can use "adb push" command as

adb push <filename> <target>

(see http://developer.android.com/guide/developing/tools/adb.html for more details), or simply use "File Explorer" in DDMS perspective then select a folder in sd card folder and select "push a file on to device" to place your files in that folder in your emulator:
在此输入图像描述

And you can use

Environment.getExternalStorageDirectory().getAbsolutePath()    

to access sd-card absolute path.

if you want to save some files in your emulator sdcard then ddms->file explorer->sdcard then push a file into device as shown in image

在此输入图像描述

when you click on the icon notified by circle a browse dialog will come then browse your file and as you select save file will be saved in sdcard of emulator

Just go through the below tutorial you will get some details about SD card usage in emulator.

Android Tutorial: Creating and Using an SD Card in the Emulator

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM