Top "Oncreate" questions

onCreate refers to one of the lifecycle methods for several components on the Android platform.

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 …

android oncreate
what is the different between onCreate() and onCreateView() lifecycle methods in Fragment?

I don't know when to use onCreate() or onCreateView(). I have used onCreate() and onCreateView() lifecycle methods. I think onCreate() …

android android-fragments android-activity fragment oncreate
Set text of spinner before item is selected

I have a spinner with three items and I use an XML string-array resource to feed it. When you open …

android spinner oncreate settext
Android: using getIntent() only within onCreate?

In Android (targeting APIs 14-16) I have a MainActivity and a NextActivity. There is no difficulty using intents to start …

android android-intent oncreate
Android: onCreate() getting called multiple times (and not by me)

There is something I don't quite understand right now. My main activity class creates a Service, which creates a new …

android multithreading oncreate
Android: Set Random colour background on create

What I want is when I load my app up it to randomly have a certain colored background from a …

android random colors background oncreate
How to restart the onCreate function

I have an application and there are certain conditions when I want my activity to be recreated or the onCreate …

android android-activity restart oncreate
How to make notification resume and not recreate activity?

I thought I had this figured out, but after some debugging on this question: How to make notification uncancellable/unremovable …

android notifications oncreate ondestroy
What is the exact difference between onAttachedToWindow and onStart

I sometimes see people using the Activity.onAttachedToWindow method but personally, I did never use it. When reading it's documentation …

android android-activity lifecycle oncreate
Why Bundle object is always null on onCreate()?

I am trying get into Android programming, and for I am taken some examples from a book. In on of …

android bundle oncreate