Skip to content

Instantly share code, notes, and snippets.

@iggym
Forked from mharper/gist:1251818
Created September 5, 2013 16:11
Show Gist options
  • Save iggym/6452326 to your computer and use it in GitHub Desktop.
Save iggym/6452326 to your computer and use it in GitHub Desktop.
public class LifecycleActivity extends Activity
{
private int createCount = 0;
private int configCount = 0;
private String sentinel = "";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d("Lifecycle", "onCreate called " + createCount + " times, sentinel is '" + sentinel + "'.");
this.sentinel = "Been here, done that";
createCount++;
}
/** Called when the activity is first created. */
@Override
public void onStart()
{
super.onStart();
Log.d("Lifecycle", "onStart called");
}
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
Log.d("Lifecycle", "onConfigurationChanged called " + configCount + " times.");
configCount++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment