Writing an Android library - Using its own custom Application class (getApplication)
<p>I'm writing an Android library and I wish to use a custom <code>Application</code> class, which will be accessible from all of the library's activities (using the <code>getApplication</code> method).</p>

<p>The problem is when I call the <code>getApplication</code> method from one of my library's activities, it returns the application class of the app using my library (and not the custom class I declared in the library's Android manifest).</p>

<p>My current guess (based on <a href="http://stackoverflow.com/a/4441424/1233767">this answer</a> and the <a href="http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject" rel="nofollow">official documentation</a>) is that the application using my library must also declare the custom <code>Application</code> class in their Android manifest - which is a problematic solution, since that application can also have its own custom class (and a single app cannot have more than one custom <code>Application</code> class, right?).</p>

<p>Can anyone offer a better solution? (or verify that this solution is accurate)</p>

<p>Any help will be appreciated..</p>
