Android_programmer_camera Android_programmer_camera -3 years ago 101
Java Question

Where do files in dataDir exist in Android?

I am working on an Android App where a file is given its location like the code given below.

The method is like this:

public boolean log(ApplicationInfo aplinfo)
{
ApplicationInfo objAppinfo;
objAppinfo = apinfo;

_strFilePath = objAppinfo.dataDir;
_strFilePath += "/";
}


Where
Appicationinfo
is my activity name.

When I see in logcat I am getting file path as

09-07 06:34:41.355: INFO/System.out(525):
FileName::::::::::/data/data/com.andr.activity/Info_SA1.txt


My doubt is where can I find this file, where does this file exist?

When I am trying to read the contents of this file, then the contents that are written in to this file are also visible. But I am not able to find the physical location of the file.

Where does data/data/com.andr.activity path exists?

Can anyone help me in sorting out this issue?
Thanks in Advance.

Answer Source

This lives in the android filesystem, which is different from your computer's file system. To view the files in android filesystem, use adb shell on the command prompt. Run: adb shell ls /data/data/com.andr.activity. Make sure your device/emulator is connected before you do this. Or if you are using eclipse, switch to DDMS view and check out the file explorer.

To View file:

adb shell
Inside shell use:
cd /data/data/com.andr.activity
cat filename

Or Use adb pull to copy file to your computer's local filesystem and then view it using any editor. Read more about adb pull here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download