I'm deriving a custom application from android.app.Application and I can't get its onCreate event being fired. Here's the implementation
import android.app.Application; public class MyApplication extends Application { public MyApplication() { super(); } @Override public void onCreate() { super.onCreate(); } }
And here's how I'm using it:
MyApplication ctrl = new MyApplication();
onCreate() method calls the setContentView() method to set the view corresponding to the activity. By default in any android application, setContentView point to activity_main. xml file, which is the layout file corresponding to MainActivity.
onCreate(savedInstanceState); calls the method in the superclass and saved InstanceState of the activity if any thing damage the activity so its saved in instanceState so when reload the activity it will be the same before.
Note that if any service is defined to run in other process e.g. with android:process= then Application's onCreate() will be called again for that process.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With