What's the root of my app?

  • Replies:2
  • OpenNot stickiedUnanswered

Dec 15, 2012 4:07:25 PM via Website

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?

Dec 27, 2012 7:12:59 PM via Website



PackageManager pm = getPackageManager();
String dataDir = getPackageName();
PackageInfo pi = pm.getPackageInfo(dataDir, 0);
dataDir = pi.applicationInfo.dataDir;

— modified on Dec 27, 2012 7:13:54 PM

Dec 27, 2012 7:17:59 PM via Website

anyway, resources are normally accessed by id, like this: R.drawable.imagename