custom android.app.Application not firing onCreate event
Add following in your AndroidManifest.xml
<application
android:name="MyApplication"
android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
</application>
then your onCreate()
will get fired.
I had this issue and found that in my case that the whole issue was phone side. I rebooted the phone and that fixed the issue.
Very simple
In your AndroidManifest.xml
, within the application
tag enter the name of your Application
sub-class with it's path under the android:name
attribute.
Example:
<application
...
android:name=".models.custom.BaseApplication"
...
> ... </application>
You don't actually create instances of your Activities with the new
operator. Instead you start an Intent like this:
Intent start = new Intent(context, Classname.class);
context.startActivity(start);
When creating an object with the new
operator, then onCreate
never will be called.
[EDIT] When creating Applications with the new
operator onCreate
won't be called either[/EDIT]
[EDIT2] You could create a static method that returns the application like this:
public static MyApplication getApp() {
return mInstance;
}
[/EDIT2]