Quantcast
Channel: alvinalexander.com - data
Viewing all articles
Browse latest Browse all 25

Android/Java: How to get your app's root data directory

$
0
0

If you ever need to get the root data directory of your Android application (app) from within your Java code, I can confirm that this approach works:

File rootDataDir = getActivity().getFilesDir();

When I log that directory like this:

Log.i(TAG, rootDataDir.toString());

it prints this output for my application:

/data/data/com.alvinalexander.mynewapp/files

where com.alvinalexander.mynewapp is the package name for my new Android app.

read more


Viewing all articles
Browse latest Browse all 25

Trending Articles