Example usage for android.os Bundle putBundle

List of usage examples for android.os Bundle putBundle

Introduction

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

Prototype

public void putBundle(@Nullable String key, @Nullable Bundle value) 

Source Link

Document

Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.limelight.testvideosdk.PreferenceFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (preferenceScreen != null) {
        Bundle container = new Bundle();
        preferenceScreen.saveHierarchyState(container);
        outState.putBundle(PREFERENCES_TAG, container);
    }/*ww  w.  ja  v a 2 s. c  o m*/
}

From source file:net.simonvt.cathode.ui.HomeActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBundle(STATE_STACK, stack.saveState());
    super.onSaveInstanceState(outState);
}

From source file:com.dahl.brendan.wordsearch.view.controller.WordSearchActivityController.java

public void saveState(Bundle outState) {
    if (outState != null) {
        this.timePause();
        outState.putLong(BUNDLE_TIME, this.timeSum);
        outState.putParcelable(BUNDLE_GRID, this.grid);
        if (this.hs != null) {
            outState.putBundle(BUNDLE_HIGH_SCORE, this.hs.toBundle());
        }/*w w w. ja  v  a2 s.c o m*/
    }
}

From source file:de.vanita5.twittnuker.activity.support.CustomTabEditorActivity.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBundle(EXTRA_EXTRAS, mExtrasBundle);
}

From source file:com.hippo.ehviewer.ui.MainActivity.java

private Announcer processAnnouncer(Announcer announcer) {
    if (0 == getSceneCount()) {
        if (Settings.getShowWarning()) {
            Bundle newArgs = new Bundle();
            newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
            newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
            return new Announcer(WarningScene.class).setArgs(newArgs);
        } else if (Settings.getAskAnalytics()) {
            Bundle newArgs = new Bundle();
            newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
            newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
            return new Announcer(AnalyticsScene.class).setArgs(newArgs);
        } else if (Crash.hasCrashFile()) {
            Bundle newArgs = new Bundle();
            newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
            newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
            return new Announcer(CrashScene.class).setArgs(newArgs);
        } else if (!EhUtils.hasSignedIn(this)) {
            Bundle newArgs = new Bundle();
            newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
            newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
            return new Announcer(SignInScene.class).setArgs(newArgs);
        }/*ww w.  j a  v  a2 s  .c  o m*/
    }
    return announcer;
}

From source file:com.dwdesign.tweetings.fragment.DMConversationFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    if (mEditText != null) {
        outState.putString(INTENT_KEY_TEXT, parseString(mEditText.getText()));
    }// w  w w.  jav a2 s  .co m
    outState.putBundle(INTENT_KEY_DATA, mArguments);
    super.onSaveInstanceState(outState);
}

From source file:ru.tinkoff.acquiring.sdk.PayFormActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    fragmentsCommunicator.onSavedInstanceState(outState);
    outState.putBundle(INSTANCE_KEY_CARDS, new CardsArrayBundlePacker().pack(cards));
    if (sourceCard != null && cards != null) {
        for (int i = 0; i < cards.length; i++) {
            if (sourceCard == cards[i]) {
                outState.putInt(INSTANCE_KEY_CARD_INDEX, i);
                break;
            }//from  w  ww  . j  av  a2s.  c  o m
        }
    }
}

From source file:com.neusou.bioroid.restful.RestfulClient.java

/**
* Executes HTTP method/*w  ww  .ja  va2s. c om*/
* @param <T> Http Request Method class
* @param <V> Restful response class
* @param <M> restful method class
* @param <R> response handler class
* @param httpMethod http request method
* @param rh response handler
* @param data extra invocation data
*/
public <T extends HttpRequestBase, V extends IRestfulResponse<?>, M extends RestfulMethod, R extends RestfulResponseHandler<V, M>> void execute(
        final T httpMethod, R rh, final Bundle data) {
    Logger.l(Logger.DEBUG, LOG_TAG, "execute() " + httpMethod.getRequestLine().toString());

    DefaultHttpClient httpClient = new DefaultHttpClient();
    V response = null;

    String exceptionMessage = null;
    String cachedResponse = null;

    boolean isResponseCached = data.getBoolean(KEY_USE_CACHE, mUseCacheByDefault);

    String requestUrl = httpMethod.getRequestLine().getUri().toString();

    Logger.l(Logger.DEBUG, LOG_TAG, "# # # # #  useCache? " + isResponseCached);

    if (mResponseCacheInitialized && isResponseCached) {
        httpMethod.getParams().setBooleanParameter("param1", true);
        //Log.d(LOG_TAG, "paramstring: "+paramString);
        cachedResponse = mCacheResponseDbHelper.getResponse(requestUrl, httpMethod.getMethod());
        Logger.l(Logger.DEBUG, LOG_TAG, "# # # # # cached response: " + cachedResponse);
        response = rh.createResponse(cachedResponse);
        response.set(new StringReader(cachedResponse));
    }

    if (cachedResponse == null) {
        try {
            response = httpClient.execute(httpMethod, rh);
        } catch (ClientProtocolException e) {
            e.printStackTrace();
            exceptionMessage = e.getMessage();
            httpMethod.abort();
        } catch (UnknownHostException e) {
            e.printStackTrace();
            exceptionMessage = "not connected to the internet";
            httpMethod.abort();
        } catch (IOException e) {
            e.printStackTrace();
            exceptionMessage = "connection error. please try again.";
            httpMethod.abort();
        }

        // cache the response
        if (exceptionMessage == null && mResponseCacheInitialized && isResponseCached) {
            Logger.l(Logger.DEBUG, LOG_TAG, "# # # # # inserting response to cache: " + response);
            M method = data.getParcelable(XTRA_METHOD);
            BufferedReader br = new BufferedReader(response.get());
            StringBuilder sb = new StringBuilder();
            char[] buffer = new char[51200];
            try {
                while (true) {
                    int bytesRead;
                    bytesRead = br.read(buffer);
                    if (bytesRead == -1) {
                        break;
                    }
                    sb.append(buffer, 0, bytesRead);
                }
                mCacheResponseDbHelper.insertResponse(requestUrl, sb.toString(),
                        Calendar.getInstance().getTime().getTime(), httpMethod.getMethod(), method.getCallId());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    // process response                  
    //Logger.l(Logger.DEBUG, LOG_TAG, "starting service with action: "+INTENT_PROCESS_RESPONSE);
    Intent processIntent = new Intent();
    processIntent.setAction(INTENT_PROCESS_RESPONSE);
    processIntent.putExtra(XTRA_RESPONSE, response);
    processIntent.putExtra(XTRA_ERROR, exceptionMessage);
    processIntent.putExtra(XTRA_REQUEST, data);
    mContext.startService(processIntent);

    boolean imcallback = data.getBoolean(KEY_IMMEDIATECALLBACK, false);
    if (imcallback) {
        Bundle callbackData = new Bundle();
        callbackData.putBundle(XTRA_REQUEST, data);
        callbackData.putParcelable(XTRA_RESPONSE, response);
        callbackData.putString(XTRA_ERROR, exceptionMessage);
        broadcastCallback(mContext, callbackData,
                generateKey(mContext.getPackageName(), mName, RestfulClient.KEY_CALLBACK_INTENT));
    }

}

From source file:com.cnm.cnmrc.fragment.vodtvch.TvchDetail.java

public TvchDetail newInstance(int selectedCategory, String title, boolean isFirstDepth, Bundle bundle) {
    mTvchDetail = new TvchDetail();
    Bundle args = new Bundle();
    args.putString("title", title);
    args.putBoolean("isFirstDepth", isFirstDepth);
    args.putBundle("bundle", bundle);
    mTvchDetail.setArguments(args);/*from   w  ww . j a  v  a  2  s.c  o  m*/
    return mTvchDetail;
}

From source file:de.tudarmstadt.informatik.secuso.phishedu2.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    //No call for super(). Bug on API Level > 11.
    outState.putString("current_frag", current_frag);
    Bundle fragcache_bundle = new Bundle();

    Iterator<Map.Entry<String, PhishBaseActivity>> it = fragCache.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<String, PhishBaseActivity> pairs = it.next();
        Bundle current_bundle = new Bundle();
        pairs.getValue().onSaveInstanceState(current_bundle);
        fragcache_bundle.putBundle(pairs.getKey(), current_bundle);
    }//from   ww w. j av a 2  s .c  o m

    outState.putBundle("fragCache", fragcache_bundle);
}