views:

36

answers:

2

Hi there :)

I have some difficulties in finding the directory in which a given class lies. E.g. I have an external lib Plugins.jar imported and want to get the parent directory... How is it done in Android?

Afaik the Dalvik VM unpacks my Plugins.jar, optimizes it and packs it together with the rest of my app. Thus I'm not sure if there is a way to get the directory at all :/

A: 

E.g. I have an external lib Plugins.jar imported and want to get the parent directory... How is it done in Android?

You don't. Any code that depends upon that needs to be rewritten for Android.

Thus I'm not sure if there is a way to get the directory at all :/

Correct. Sorry!

CommonsWare
+1  A: 

All classes are packed into a single file called classes.dex, so you can't get the path of a class file. You can get files packed into the apk, if that is what you want. See openFileOutput() for details.

Martin