Search code examples
androidandroid-activity

Android onCreate extras


When my activity starts receive data as extras

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_appointment_details);

    m_Model = (mModel) getIntent().getSerializableExtra("MODEL");

}

when my application is in backgroud: if the activty is destroyed and recreated by OS, the onCreate method is Called, i want to know if the original Extra used for create the activity is still passed with the intent.

enter image description here

Else I need to save the extra in the InstanceState and retreive it? if so, i have to check if savedInstanceState is null before getSerializableExtra?


Solution

  • Processes And Application You will find the explanation from here.

    The getIntent() values are received if you activity is recreated. If you want to get the updated values than you have to store it in savedInstanceState and get it from it.

    Sometimes if system killed your application(Need More Memory) and than if you open the application at that your application starts from splash and you will not get any value.