views:

27

answers:

1

Hi all!

I list out files in '/' by:

File directory = new File("/");
fill_listview(directory.listFiles());

And I get those in list:

sqlite_stmt_journals
config
cache
sdcard
d
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev

I have two questions:

1.Why cann't I access '/data' folder just like Eclipse DDMS file explorer?

2.Why it is different from the DDMS which show only:

data
sdcard
system

Thanks!

+1  A: 

It is mostly because of security issues. If /data folder is visible to everyone, then some malicious app can read/temper/delete the data of some other app which can get really worse if some app is storing some sensitive data like password/credit card number etc. So the whole filesystem is only visible via debug console (or ddms).
You can not access data of any app on the device unless it is rooted because by doing so, integrity of system might be compromised and it may lead of weird behavior. Which means you can not access cached data/databases of app.

bhups
Thanks a lot! Now I know it is because of Android access controls. This is really helped.
herbertD