Android Forum » Android Developer Forum » Android Developer Forum » What's the root of my app?

What's the root of my app?

What's the root of my app?
created on Dec 15, 2012 4:07:25 PM
Hi,
i'm trying to develop a simple android app.
I want to know if an image exist in one of my app folder, but i dont' know what's the root of my app; i tried
File nomeFile = new File("res/drawable-hdpi/imagename.jpg")
File nomeFile = new File("myappanem/res/drawable-hdpi/imagename.jpg")

but it doens't work :(

Can somebody help me?
Reply with quote Reply Link ±0     (0 votes)
RE: What's the root of my app?
created on Dec 27, 2012 7:12:59 PM — modified on Dec 27, 2012 7:13:54 PM
myActivity.getDir();

or

PackageManager pm = getPackageManager();
String dataDir = getPackageName();
PackageInfo pi = pm.getPackageInfo(dataDir, 0);
dataDir = pi.applicationInfo.dataDir;
Reply with quote Reply Link ±0     (0 votes)
RE: What's the root of my app?
created on Dec 27, 2012 7:17:59 PM
anyway, resources are normally accessed by id, like this: R.drawable.imagename
Reply with quote Reply Link ±0     (0 votes)