Android.app.Activity read the summary, sometimes will not need to maintain some of the site data? Want to let the system help you out into the background or hang up before doing some pre-maintenance work, the key reference:

Source: Internet
Author: User

*
* @param savedinstancestate If The activity is being re-initialized after
* Previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}. <b><i>note:otherwise It is null.</i></b>
*
* @see #onStart
* @see #onSaveInstanceState
* @see #onRestoreInstanceState
* @see #onPostCreate
*/
protected void OnCreate (@Nullable Bundle savedinstancestate) {
if (debug_lifecycle) slog.v (TAG, "onCreate" + This + ":" + savedinstancestate);
if (mlastnonconfigurationinstances! = null) {
Mallloadermanagers = mlastnonconfigurationinstances.loaders;
}
if (mactivityinfo.parentactivityname! = null) {
if (Mactionbar = = null) {
Menabledefaultactionbarup = true;
} else {
Mactionbar.setdefaultdisplayhomeasupenabled (TRUE);
}
}
if (savedinstancestate! = null) {
Parcelable p = savedinstancestate.getparcelable (Fragments_tag);
Mfragments.restoreallstate (p, mlastnonconfigurationinstances! = null
? MLastNonConfigurationInstances.fragments:null);
}
Mfragments.dispatchcreate ();
Getapplication (). dispatchactivitycreated (this, savedinstancestate);
if (mvoiceinteractor! = null) {
Mvoiceinteractor.attachactivity (this);
}
Mcalled = true;
}

/**
* Same as {@link #onCreate (android.os.Bundle)} but called-those activities created with
* The attribute {@link Android. R.attr#persistablemode} set to
* &LT;CODE&GT;PERSISTACROSSREBOOTS&LT;/CODE&GT;.
*
* @param savedinstancestate If the activity is being re-initialized after
* Previously being shut down then this Bundle contains the data it most
* recently supplied in {@link #onSaveInstanceState}.
* <b><i>note:otherwise It is null.</i></b>
* @param persistentstate If the activity is being re-initialized after
* Previously being shut down or powered off then this Bundle contains the data it most
* Recently supplied to outpersistentstate in {@link #onSaveInstanceState}.
* <b><i>note:otherwise It is null.</i></b>
*
* @see #onCreate (android.os.Bundle)
* @see #onStart
* @see #onSaveInstanceState
* @see #onRestoreInstanceState
* @see #onPostCreate
*/
public void OnCreate (@Nullable Bundle savedinstancestate,
@Nullable Persistablebundle persistentstate) {
OnCreate (savedinstancestate);
}

/**
* The hook for {@link activitythread} to restore the state of this activity.
*
* Calls {@link #onSaveInstanceState (Android.os.Bundle)} and
* {@link #restoreManagedDialogs (android.os.Bundle)}.
*
* @param savedinstancestate contains the saved state
*/
final void Performrestoreinstancestate (Bundle savedinstancestate) {
Onrestoreinstancestate (savedinstancestate);
Restoremanageddialogs (savedinstancestate);
}

/**
* The hook for {@link activitythread} to restore the state of this activity.
*
* Calls {@link #onSaveInstanceState (Android.os.Bundle)} and
* {@link #restoreManagedDialogs (android.os.Bundle)}.
*
* @param savedinstancestate contains the saved state
* @param persistentstate contains the persistable saved state
*/
final void Performrestoreinstancestate (Bundle savedinstancestate,
Persistablebundle persistentstate) {
Onrestoreinstancestate (Savedinstancestate, persistentstate);
if (savedinstancestate! = null) {
Restoremanageddialogs (savedinstancestate);
}
}

/**
* This method was called after {@link #onStart} when the activity is
* Being re-initialized from a previously saved, given
* &LT;VAR&GT;SAVEDINSTANCESTATE&LT;/VAR&GT;. Most implementations would simply use {@link #onCreate}
* To-restore their state, but it's sometimes convenient to does it here
* After all of the initialization have been done or to allow subclasses to
* Decide whether to use your default implementation. The default
* Implementation of this method performs a restore of any view state that
* had previously been frozen by {@link #onSaveInstanceState}.
*
* <p>this method is called between {@link #onStart} and
* {@link #onPostCreate}.
*
* @param savedinstancestate The data most recently supplied in {@link #onSaveInstanceState}.
*
* @see #onCreate
* @see #onPostCreate
* @see #onResume
* @see #onSaveInstanceState
*/
protected void Onrestoreinstancestate (Bundle savedinstancestate) {
if (Mwindow! = null) {
Bundle windowState = Savedinstancestate.getbundle (Window_hierarchy_tag);
if (windowState! = null) {
Mwindow.restorehierarchystate (windowState);
}
}
}

/**
* This is the same as {@link #onRestoreInstanceState (Bundle)} and is called for activities
* Created with the attribute {@link Android. R.attr#persistablemode} set to
* &LT;CODE&GT;PERSISTACROSSREBOOTS&LT;/CODE&GT;. The {@link Android.os.PersistableBundle} passed
* Came from the restored Persistablebundle first
* Saved in {@link #onSaveInstanceState (Bundle, Persistablebundle)}.
*
* <p>this method is called between {@link #onStart} and
* {@link #onPostCreate}.
*
* <p>if This method is called {@link #onRestoreInstanceState (Bundle)} won't is called.
*
* @param savedinstancestate The data most recently supplied in {@link #onSaveInstanceState}.
* @param persistentstate The data most recently supplied in {@link #onSaveInstanceState}.
*
* @see #onRestoreInstanceState (Bundle)
* @see #onCreate
* @see #onPostCreate
* @see #onResume
* @see #onSaveInstanceState
*/
public void Onrestoreinstancestate (Bundle savedinstancestate,
Persistablebundle persistentstate) {
if (savedinstancestate! = null) {
Onrestoreinstancestate (savedinstancestate);
}
}

/**
* Restore the state of any saved managed dialogs.
*
* @param savedinstancestate The bundle to restore from.
*/
private void Restoremanageddialogs (Bundle savedinstancestate) {
Final Bundle B = Savedinstancestate.getbundle (Saved_dialogs_tag);
if (b = = null) {
Return
}

Final int[] ids = B.getintarray (Saved_dialog_ids_key);
Final int numdialogs = ids.length;
Mmanageddialogs = new sparsearray<manageddialog> (numdialogs);
for (int i = 0; i < numdialogs; i++) {
Final Integer dialogID = ids[i];
Bundle dialogstate = B.getbundle (Saveddialogkeyfor (dialogID));
if (dialogstate! = null) {
Calling Onrestoreinstancestate () below would invoke Dispatchoncreate
So-tell Createdialog () does it, otherwise we get an exception
Final Manageddialog MD = new Manageddialog ();
Md.margs = B.getbundle (Saveddialogargskeyfor (dialogID));
Md.mdialog = Createdialog (dialogID, Dialogstate, Md.margs);
if (md.mdialog! = null) {
Mmanageddialogs.put (dialogID, MD);
Onpreparedialog (dialogID, Md.mdialog, Md.margs);
Md.mDialog.onRestoreInstanceState (dialogstate);
}
}
}
}

Android.app.Activity read the summary, sometimes will not need to maintain some of the site data? Want to let the system help you out into the background or hang up before doing some pre-maintenance work, the key reference:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.