开发者

Getting the path to where my classes lie in Android

开发者 https://www.devze.com 2023-01-11 02:30 出处:网络
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?

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开发者_Python百科 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 :/


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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消