Reputation: 61
How to open text file in android emulator? I have to locate it to read, I have tried mksdcard but it is not creating sdcard.img:
C:\Program Files (x86)\Android\android-sdk\tools>mksdcard -l mySdCard 1024M "C:\
mySdCardFile.img"
If it would work I don't know what to do next. My java code is below
File file = new File("mytextfile.txt");
System.out.println("This is your file");
System.out.println(file);
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
System.out.println(fin);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
I am working on windows with eclipse. Please help. Thanks in advance.
Upvotes: 1
Views: 1247
Reputation: 2232
It doesn't make a difference being in Windows or in the emulator.
You just need to create a file under a folder you actually have permissions (like the sdcard folder or the cache folder) and you are able to read it.
You won't be able to access it from Windows, though, since it is contained in the emulator image.
Upvotes: 1