开发者

How to select a file from android memory to do some action on it

I want to transfer a file into android dev's SD memory and read the file for parsing it. But i don't know how to transfer a file into the emulators SD Card.

Also I don't know which api is to be used to browse for the file from the application. This app provides the user to show it where he has kept the file wh开发者_C百科ich the app has to parse. Which api does android provide for file management using a UI.

Please help. Thanks in advance.


Steps to push the file into Adroid Emulator SDcard in eclipse.

  1. Click on the DDMS tab on the right top corner of the eclipse IDE
  2. Go to File Explore in it, if not there the Windows->Show View->File Explorer
  3. Click on the SDCard in the file explorer
  4. 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

Shell commands to push and pull files from/to SDcard

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

To read the file programatically you use

import java.io.File

File lObjFile = new File("sdcard/fileName.ext");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜