我想将文件传输到android dev的SD内存中并读取文件进行解析。 但是我不知道如何将文件传输到模拟器的 SD 卡中。
我也不知道要使用哪个 api 从应用程序中浏览文件。 这个应用程序让用户可以显示他保存应用程序必须解析的文件的位置。 android提供了哪些api来使用UI进行文件管理。
请帮忙。 提前致谢。
最佳答案
在eclipse中将文件推送到Adroid Emulator SDcard的步骤。
- Click on the DDMS tab on the right top corner of the eclipse IDE
- Go to File Explore in it, if not there the Windows->Show View->File Explorer
- Click on the SDCard in the file explorer
- On the top of the File Explorer there are 2 Arrows(Right direction and Left Direction) To put the file into the SD card press the right direction arrow, browse the location
where the file is located click Ok, To pull the file back from the SDcard click on the
file to be pulled the click on the left direction arrow
向 SD 卡推送和拉取文件的 Shell 命令
device commands:
adb push <local> <remote> - copy file/dir to device adb pull <remote> <local> - copy file/dir from device
Push sends a file from your desktop computer to your Android device:
adb push test.txt /sdcard/test.txt
Pull pulls a file from your Android device to your desktop computer:
adb pull /sdcard/test.txt test.txt
以编程方式读取文件 使用
import java.io.File
File lObjFile = new File("sdcard/fileName.ext");
关于android - 如何从android内存中选择一个文件对其进行一些操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2264042/