Writing An Android Library - Using Its Own Custom Application Class (getapplication)
I'm writing an Android library and I wish to use a custom Application class, which will be accessible from all of the library's activities (using the getApplication method). The pr
Solution 1:
Nothing wrong with your custom Application implementation and AndroidManifest.xml. The correct way of using your custom Application in code is casting.
Suppose you have a MyApplication that extends android.app.Application, to get MyApplication instead of Application:
BooleanrunInTest= ((MyApplication) getApplication()).isRunInTet();
Hope that helps.
Post a Comment for "Writing An Android Library - Using Its Own Custom Application Class (getapplication)"