Example usage for android.os Bundle toString

List of usage examples for android.os Bundle toString

Introduction

In this page you can find the example usage for android.os Bundle toString.

Prototype

@Override
    public synchronized String toString() 

Source Link

Usage

From source file:android.app.Activity.java

/**
 * Called when the activity is starting.  This is where most initialization
 * should go: calling {@link #setContentView(int)} to inflate the
 * activity's UI, using {@link #findViewById} to programmatically interact
 * with widgets in the UI, calling/*from   www. j  a va  2 s .  com*/
 * {@link #managedQuery(android.net.Uri , String[], String, String[], String)} to retrieve
 * cursors for data being displayed, etc.
 * 
 * <p>You can call {@link #finish} from within this function, in
 * which case onDestroy() will be immediately called without any of the rest
 * of the activity lifecycle ({@link #onStart}, {@link #onResume},
 * {@link #onPause}, etc) executing.
 * 
 * <p><em>Derived classes must call through to the super class's
 * implementation of this method.  If they do not, an exception will be
 * thrown.</em></p>
 * 
 * @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(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 (isAvailable()) {
        /* if this device can use the platform */
        Log.w("MIGRATOR", "This is " + getLocalClassName());
        Intent intent = getIntent();
        Bundle tmpBundle = intent.getBundleExtra("MIGRATED");
        ArrayList<Bundle> stacked = intent.getParcelableArrayListExtra("MIGRATED STACK");
        if (tmpBundle != null) {
            /* true if this Activity was migrated */
            if (stacked != null) {
                /* true if this Activity called next Activity */
                Intent next = new Intent();
                Bundle nextBundle = stacked.get(0);
                next.setClassName(nextBundle.getString("MIGRATED PNAME"),
                        nextBundle.getString("MIGRATED CNAME"));
                next.putExtra("MIGRATED", nextBundle);
                stacked.remove(0);
                int code = tmpBundle.getInt("MIGRATED REQUEST CODE");
                Bundle option = nextBundle.getBundle("MIGRATED REQUEST OPTIONS");
                if (!stacked.isEmpty()) {
                    /* store for next Activity */
                    next.putParcelableArrayListExtra("MIGRATED STACK", stacked);
                }
                Log.w("MIGRATOR", "Start ForResult: code=" + code);
                mReceiverStackFlag = true;
                mStackedNextIntent = next;
                mStackedNextCode = code;
                mStackedNextOption = option;
            } else {
                /* for debug */
                Log.w("MIGRATOR", "stack is null");
            }
            savedInstanceState = null;
            mMigFlag = true;
            migratedState = tmpBundle;
            Intent tmpIntent = tmpBundle.getParcelable("MIGRATED_INTENT");
            if (tmpIntent != null) {
                tmpIntent.setAction(Intent.ACTION_MIGRATE);
                setIntent(tmpIntent);
            }

            /* File handling */
            ArrayList<String> tmpNames = tmpBundle.getStringArrayList("TARGET_FILE_NAME");
            if (tmpNames != null) {
                FileWorker fw = new FileWorker(tmpNames.toArray(new String[tmpNames.size()]),
                        FileWorker.WRITE_MODE);
                fw.start();
                tmpNames = null;
            }
            Log.w("MIGRATOR", "successed migaration: " + tmpBundle.toString());
            tmpBundle = null;
        } else {
            /* for debug */
            Log.w("MIGRATOR", "tmpBundle is null");
        }
    }

    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        mFragments.restoreAllState(p,
                mLastNonConfigurationInstances != null ? mLastNonConfigurationInstances.fragments : null);
    }
    mFragments.dispatchCreate();
    getApplication().dispatchActivityCreated(this, savedInstanceState);
    mCalled = true;

}