开发者

I want to read a local text file on my computer on an Android Emulator

开发者 https://www.devze.com 2023-03-11 18:41 出处:网络
How can I put that file in userdata.img so that the emulator can read it? Also, how can 开发者_运维百科to specifiy the path of the file in the code? I am using Windows 7.To push a file onto the emulat

How can I put that file in userdata.img so that the emulator can read it? Also, how can 开发者_运维百科to specifiy the path of the file in the code? I am using Windows 7.


To push a file onto the emulator or any other rooted device you'd just issue a adb push command.

adb push FILE PATH_ON_DEVICE

In Java to define the path to a file you can simply create a File object with the path set in its constructor.

File file = new File("/path/on/device");


You can use adb to push the file to whatever location you want. Just start the emulator (without any device connected) and type

adb push myfile /mylocation/myfile

Here is the manual page for the commands: http://developer.android.com/guide/developing/tools/adb.html

Alternatively, you can browse the file system using ddms

0

精彩评论

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