Is it normal for the “activity.onCreate()” method to be called multiple times

I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour? Thanks.

  • How to use Zxing in portrait mode?
  • How is it possible that Google Fit app measures number of steps all the time without draining battery?
  • Android Studio Gradle project “Unable to start the daemon process /initialization of VM”
  • Android referral tracking not working with Google play
  • extract yaw, pitch, and roll from a rotationMatrix
  • Android In-App Billing v3: “Can't perform operation: queryInventory”
  • Related posts:

    Android - NullPointerException on SearchView in Action Bar
    What version of Apache HTTP Client is bundled in Android 1.6?
    Why Use Start Activities?
    Error Loading Project: Cannot load 3 facets Details
    Android internet connectivity check problem
    XMPP and Android
  • Android Wear App not installed
  • How to hide the address bar of a webpage in android?
  • JNI bitmap operations , for helping to avoid OOM when using large images
  • Enabling Location mode High Accuracy or Battery saving, programmatically, without user needing to visit Settings
  • Are static fields in Activity classes guaranteed to outlive a create/destroy cycle?
  • Android: AVD-Settings for Galaxy S3-Like AVD
  • 4 Solutions collect form web for “Is it normal for the “activity.onCreate()” method to be called multiple times”

    You might want to read through the documentation on the Activity lifecycle.

    OnCreate will only be called one time for each lifetime of the Activity. However, there are a number of situations that can cause your activity to be killed and brought back to life. Thus, onCreate will be called again.

    To support this properly, you can save state information in onSaveInstanceState and restore it fron the state bundle you get in on create.

    Other than the expected cases, I have observed that only those activities (onCreate) are called twice which are creating new Thread or Runnable. (I believe this to be a bug in Android).

    The solution is simple (though you may not like it :p)

        protected void onCreate(Bundle savedInstanceState) {
            if(savedInstanceState == null){
                // everything else that doesn't update UI

    You can also handle the configuration changes on your own, setting on the AndroidManifest the following statement, in the activity configuration:


    For further information, you can have a look at the official documentation

    The below is a scenario I encountered (and solved) which produces the behavior you are describing:

    There are 3 events that will trigger OnTouch – 1. android.view.MotionEvent.ACTION_UP 2. android.view.MotionEvent.ACTION_DOWN 3. android.view.MotionEvent.ACTION_MOVE.

    Often, all three of these events fire at the same time to trigger the OnTouch listener. When this listener is used to launch an activity (via an Intent passed to startActivity()), you can reproduce this behavior which would call OnCreate on the Activity multiple times (3 in this example).

    If it’s not this listener type you are using to start the activity, you may want to look into the documentation for whatever listener is triggering your activity to see if you are experiencing a similar scenario. Chances are that not just one event triggers the listener.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.