Example usage for android.os Bundle putCharSequence

List of usage examples for android.os Bundle putCharSequence

Introduction

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

Prototype

@Override
public void putCharSequence(@Nullable String key, @Nullable CharSequence value) 

Source Link

Document

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

Usage

From source file:th.in.ffc.person.visit.VisitAncPregnancyActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("action", mAction);
    outState.putInt("min", mMinPregNo);
    outState.putCharSequence("hint", Hint.getText());
    outState.putString("pregno", mPregNo);
    outState.putBoolean("enable", PregNo.isEnabled());
    outState.putBoolean("showRisk", RiskLayout.isShown());
}

From source file:de.vanita5.twittnuker.fragment.support.DirectMessagesConversationFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mEditText != null) {
        outState.putCharSequence(EXTRA_TEXT, mEditText.getText());
    }// w w  w.j  a va  2  s . c  o  m
    outState.putLong(EXTRA_ACCOUNT_ID, mAccountId);
    outState.putLong(EXTRA_RECIPIENT_ID, mRecipientId);
    outState.putString(EXTRA_IMAGE_URI, mImageUri);
}

From source file:jp.co.noxi.app.NXProgressDialog.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(SAVED_PROGRESS_STYLE, mStyle);
    outState.putInt(SAVED_MAX, mMax);//from w  ww.j a v  a 2s . c o m
    outState.putInt(SAVED_PROGRESS_VALUE, mProgressVal);
    outState.putInt(SAVED_SECONDARY_PROGRESS_VALUE, mSecondaryProgressVal);
    outState.putBoolean(SAVED_INDETERMINATE, mIndeterminate);
    if (mMessage != null) {
        outState.putCharSequence(SAVED_MESSAGE, mMessage);
    }
    if (mFormat != null) {
        outState.putString(SAVED_FORMAT, mFormat);
    }
}

From source file:com.cuddlesoft.nori.SearchActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Preserve SearchView state.
    if (searchView != null) {
        outState.putCharSequence(BUNDLE_ID_SEARCH_QUERY, searchView.getQuery());
        outState.putBoolean(BUNDLE_ID_SEARCH_VIEW_IS_EXPANDED,
                MenuItemCompat.isActionViewExpanded(searchMenuItem));
        outState.putBoolean(BUNDLE_ID_SEARCH_VIEW_IS_FOCUSED, searchView.isFocused());
    }/*from w w w  .  ja v  a 2  s.  co  m*/
}

From source file:io.github.tjg1.nori.SearchActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Preserve SearchView state.
    if (searchView != null) {
        outState.putCharSequence(BUNDLE_ID_SEARCH_QUERY, searchView.getQuery());
        outState.putBoolean(BUNDLE_ID_SEARCH_VIEW_IS_EXPANDED,
                MenuItemCompat.isActionViewExpanded(searchMenuItem));
        outState.putBoolean(BUNDLE_ID_SEARCH_VIEW_IS_FOCUSED, searchView.isFocused());
        if (searchClient != null) {
            outState.putParcelable(BUNDLE_ID_SEARCH_CLIENT_SETTINGS, searchClient.getSettings());
        }//from w w w  . j  a v  a 2 s .  co m
    }
}

From source file:com.osecurityapp.PubSubActivity.java

@Override
protected void onSaveInstanceState(final Bundle bundle) {
    super.onSaveInstanceState(bundle);
    // Save the title so it will be restored properly to match the view loaded when rotation
    // was changed or in case the activity was destroyed.
    if (toolbar != null) {
        bundle.putCharSequence(BUNDLE_KEY_TOOLBAR_TITLE, toolbar.getTitle());
    }//from  w w  w . j a  v  a  2 s  .c o m
}

From source file:it.scoppelletti.mobilepower.widget.DateControl.java

protected void onSaveInstanceState(Bundle outState) {
    if (!StringUtils.isBlank(myDialogTag)) {
        outState.putString(DateControl.STATE_DIALOGTAG, myDialogTag);
    }/*from  ww  w  . j av a  2  s .co m*/
    if (myIsEmptyAllowed) {
        outState.putBoolean(DateControl.STATE_ISEMPTYALLOWED, true);
    }
    if (myIsResetEnabled) {
        outState.putBoolean(DateControl.STATE_ISRESETENABLED, true);
    }
    if (!ValueTools.isNullOrEmpty(myValue)) {
        outState.putParcelable(DateControl.STATE_VALUE, myValue);
    }
    if (myValueControl.getError() != null) {
        outState.putCharSequence(DateControl.STATE_ERROR, myValueControl.getError());
    }
}

From source file:de.geeksfactory.opacclient.frontend.OpacActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean("twoPane", twoPane);
    if (fragment != null)
        getSupportFragmentManager().putFragment(outState, "fragment", fragment);
    if (mTitle != null)
        outState.putCharSequence("title", mTitle);
}

From source file:me.xiaopan.android.inject.sample.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    listView = new ListView(getBaseContext());
    setContentView(listView);/*  ww w  . j a v a  2 s  .c o  m*/

    // SharedPreferences?
    PreferenceUtils.putBoolean(getBaseContext(), KEY_BOOLEAN, true);
    PreferenceUtils.putFloat(getBaseContext(), KEY_FLOAT, 10000f);
    PreferenceUtils.putInt(getBaseContext(), KEY_INT, 2000);
    PreferenceUtils.putLong(getBaseContext(), KEY_LONG, 50000);
    PreferenceUtils.putString(getBaseContext(), KEY_STRING, "Preference String");
    Set<String> stringSet = new HashSet<String>();
    stringSet.add("String Set 1");
    stringSet.add("String Set 2");
    stringSet.add("String Set 3");
    stringSet.add("String Set 4");
    PreferenceUtils.putStringSet(getBaseContext(), KEY_STRING_SET, stringSet);
    MyBean bean2 = new MyBean();
    bean2.setEmail("sky@xiaopan.me2");
    bean2.setName("?2");
    bean2.setSex("2");
    PreferenceUtils.putObject(getBaseContext(), KEY_JSON, bean2);
    PreferenceUtils.putString(getBaseContext(), KEY_ENUM, Sex.WOMAN.name());

    // ??
    String[] items = new String[] { "", "?", "FragmentDialog",
            "InjectAdapter", "InjectExpandableListAdapter" };
    listView.setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1,
            android.R.id.text1, items));
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position <= 2) {
                Bundle bundle = new Bundle();
                bundle.putBoolean(MainActivity.PARAM_BOOLEAN, true);
                bundle.putBooleanArray(MainActivity.PARAM_BOOLEAN_ARRAY, new boolean[] { true, false, true });
                bundle.putByte(MainActivity.PARAM_BYTE, (byte) 110);
                bundle.putByteArray(MainActivity.PARAM_BYTE_ARRAY, new byte[] { 111, 112, 113 });
                bundle.putChar(MainActivity.PARAM_CHAR, 'R');
                bundle.putCharArray(MainActivity.PARAM_CHAR_ARRAY, new char[] { 'c', 'h', 'a', 'r' });
                bundle.putCharSequence(MainActivity.PARAM_CHAR_SEQUENCE, "CharSequence");
                bundle.putCharSequenceArray(MainActivity.PARAM_CHAR_SEQUENCE_ARRAY,
                        new CharSequence[] { "Char", " ", "Sequence" });
                bundle.putDouble(MainActivity.PARAM_DOUBLE, 12.00d);
                bundle.putDoubleArray(MainActivity.PARAM_DOUBLE_ARRAY, new double[] { 12.01d, 12.02d, 12.03d });
                bundle.putFloat(MainActivity.PARAM_FLOAT, 13.00f);
                bundle.putFloatArray(MainActivity.PARAM_FLOAT_ARRAY, new float[] { 13.01f, 13.02f, 13.03f });
                bundle.putInt(MainActivity.PARAM_INT, 120);
                bundle.putIntArray(MainActivity.PARAM_INT_ARRAY, new int[] { 121, 122, 123, });
                bundle.putLong(MainActivity.PARAM_LONG, 12345);
                bundle.putLongArray(MainActivity.PARAM_LONG_ARRAY, new long[] { 12346, 12347, 12348 });
                bundle.putShort(MainActivity.PARAM_SHORT, (short) 2);
                bundle.putShortArray(MainActivity.PARAM_SHORT_ARRAY, new short[] { 3, 4, 5 });
                bundle.putString(MainActivity.PARAM_STRING, "String");
                bundle.putStringArray(MainActivity.PARAM_STRING_ARRAY,
                        new String[] { "String1", "String2", "String3" });

                // ??JSONBundle
                MyBean bean = new MyBean();
                bean.setEmail("sky@xiaopan.me");
                bean.setName("?");
                bean.setSex("");
                bundle.putString(PARAM_STRING_JSON, new Gson().toJson(bean));

                bundle.putString(MainActivity.PARAM_STRING_ENUM, Sex.WOMAN.name());

                // 
                ArrayList<String> stringList = new ArrayList<String>();
                stringList.add("ArrayList String 1");
                stringList.add("ArrayList String 2");
                stringList.add("ArrayList String 3");
                bundle.putStringArrayList(MainActivity.PARAM_STRING_ARRAY_LIST, stringList);
                switch (position) {
                case 0:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent = new Intent(getBaseContext(), InjectTestActivity.class);
                    intent.putExtras(bundle);
                    startActivity(intent);
                    break;
                case 1:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent2 = new Intent(getBaseContext(), NormalActivity.class);
                    intent2.putExtras(bundle);
                    startActivity(intent2);
                    break;
                case 2:
                    Second.SECOND_CHRONOGRAPH.lap();
                    new TestDialogFragment().show(getSupportFragmentManager(), "");
                    break;
                }
            } else {
                Class<?> targetClass = null;
                if (position == 3) {
                    targetClass = InjectAdapterActivity.class;
                } else if (position == 4) {
                    targetClass = InjectExpandableListAdapterActivity.class;
                }
                if (targetClass != null) {
                    startActivity(new Intent(getBaseContext(), targetClass));
                }
            }
        }
    });
}

From source file:org.getlantern.firetweet.fragment.support.MessagesConversationFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mEditText != null) {
        outState.putCharSequence(EXTRA_TEXT, mEditText.getText());
    }// w w  w  .j  ava2s.  c o m
    outState.putParcelable(EXTRA_ACCOUNT, mAccount);
    outState.putParcelable(EXTRA_USER, mRecipient);
    outState.putString(EXTRA_IMAGE_URI, mImageUri);
}