package com.example.lifecycletest;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;

/** Reference
 * http://developer.android.com/reference/android/app/Activity.html
 */
public class LifeCycleActivity extends Activity {

    private String TAG = "*** LifeCycleActivity: TAG is not set ***";

    public void setTag(String tag, Object object) {
        this.TAG = "*** " + tag + "@" + Integer.toHexString(System.identityHashCode(object))+ " ***";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d("********************", getClass().getSimpleName() + " start ﹕********************");
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName+ " (savedInstanceState: " + getBundleInfo(savedInstanceState) + ")");
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onStart() {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onStart();
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName + " (savedInstanceState: " + getBundleInfo(savedInstanceState) + ")");
        super.onRestoreInstanceState(savedInstanceState);
    }

    @Override
    protected void onResume() {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onResume();
    }

    // called when setting 'android:configChanges="orientation|screenSize"' in your manifest
    // http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        return true;
    }

    @Override
    protected void onPause() {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onPause();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName + " (outState: " + getBundleInfo(outState) + ")");
        super.onSaveInstanceState(outState);
    }

    @Override
    protected void onStop() {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        String methodName = new Object(){}.getClass().getEnclosingMethod().getName();
        Log.d(TAG, methodName);
        super.onDestroy();
    }

    private static String getBundleInfo(Bundle bundle) {
        String info = bundle == null
                ? "null"
                : "Bundle@" + Integer.toHexString(System.identityHashCode(bundle));
        return info;
    }
}

@@ -1692,271 +1692,285 @@
     
-// called when setting 'android:configChanges=%22orientation%7CscreenSize%22' in your manifest%0A    // http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange%0A    @Override%0A    public void onConfigurationChanged(Configuration newConfig
+@Override%0A    public void onAttachedToWindow() %7B%0A        String methodName = new Object()%7B%7D.getClass().getEnclosingMethod().getName();%0A        Log.d(TAG, methodName);%0A        super.onAttachedToWindow();%0A    %7D%0A%0A    @Override%0A    public void onWindowFocusChanged(boolean hasFocus
 ) %7B%0A
@@ -2107,38 +2107,35 @@
 r.on
-ConfigurationChanged(newConfig
+WindowFocusChanged(hasFocus
 );%0A 
@@ -2344,32 +2344,477 @@
 rn true;%0A    %7D%0A%0A
+    // called when setting 'android:configChanges=%22orientation%7CscreenSize%22' in your manifest%0A    // http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange%0A    @Override%0A    public void onConfigurationChanged(Configuration newConfig) %7B%0A        String methodName = new Object()%7B%7D.getClass().getEnclosingMethod().getName();%0A        Log.d(TAG, methodName);%0A        super.onConfigurationChanged(newConfig);%0A    %7D%0A%0A
     @Override%0A  
@@ -3671,24 +3671,242 @@
 y();%0A    %7D%0A%0A
+    @Override%0A    public void onDetachedFromWindow() %7B%0A        String methodName = new Object()%7B%7D.getClass().getEnclosingMethod().getName();%0A        Log.d(TAG, methodName);%0A        super.onDetachedFromWindow();%0A    %7D%0A%0A
     private 

Add activity methods