What's the root of my app?

  • Replies:2
  • OpenNot stickiedUnanswered

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

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?

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

myActivity.getDir();

or

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