How can I access files stored in my PC from AVD?

488 Views Asked by At

I want to access the information stored in a text file that is in my PC and display it in a ListView inside the AVD.I do no want to push the file into the avd.I want my app to access such files from a server(in this case my PC)and display the information in it. Let's say the file is stored in C:\users. How do I access it?

1

There are 1 best solutions below

1
On

The emulator is a separate virtual computer (usually called guest) inside your PC (host).

Guests can not access anything from the host PC directly. The only communication between both can be done via a network service.

Therefore you need on your PC a server providing a service like HTTP and on your Android emulator a client (HttpUrlConnection) that can communicate with the server and therefore get access to the file.

There are a lot of mini web servers available that allow to publish one directory of your PC.

You can access your PC and the HTTP server from within the emulator using the IP address 10.0.2.2.