I have a project (in Eclipse) that I turned into an Android project library to reuse part of the code in another similar project. I think I was shot in the leg, because I get the error:
Unable to start activity ComponentInfo{com.test.scroller1/com.lib.scrolltest.ScrollTestActivity}: java.lang.ClassCastException: android.app.Application cannot be cast to com.lib.scrolltest.resAppVars
com.lib.scrolltest is my project library that instantiates an application extension class (resAppVars). In the onCreate () method, I call:
mRav = (resAppVars) getApplicationContext ();
Thus, I can use the methods in the mRav object, which otherwise would have been a lot of duplicated code in other classes (for example, passing a request to a generic select statement that returns an ArrayList of results).
What is the problem? I seem to have come across a limitation on how I implemented the Application class.
wufoo source
share