when(bundle.getCharSequenceArray(anyString())).thenAnswer(get);
public CharSequence[] getCharSequences(String key,CharSequence[] defValue){ if (mBundle != null) { return mBundle.getCharSequenceArray(key); } return defValue; }
public CharSequence[] getCharSequenceArray(Bundle state, String key) { return state.getCharSequenceArray(key + mBaseKey); }
// Your mentioned code Bundle b = getIntent().getExtras(); CharSequence[] questionsCorrect = b.getCharSequenceArray("questionsCorrect"); CharSequence[] answersCorrect = b.getCharSequenceArray("answersCorrect"); // Create a list of questions and answers. Make sure both arrays have same length QAnsModel model; ArrayList<QAnsModel> dataList = new ArrayList<>(); for(int i = 0; i < questionsCorrect.length; i++) { model = new QAnsModel(questionsCorrect[i].toString(), answersCorrect[i].toString()); dataList.add(model); }
protected CharSequence[] getTabButtonText() { return getArguments().getCharSequenceArray(ARG_TAB_BUTTON); }
Bundle extras = sbn.getNotification().extras; CharSequence[] lines = extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES); JSONArray s = new JSONArray(); for (CharSequence msg : lines) { msg = removeSpaces(msg); if (!TextUtils.isEmpty(msg)) { s.put(msg.toString()); } } private static String removeSpaces(@Nullable CharSequence cs) { if (cs == null) return null; String string = cs instanceof String ? (String) cs : cs.toString(); return string.replaceAll("(\\s+$|^\\s+)", "").replaceAll("\n+", "\n"); }
static RemoteInputCompatBase.RemoteInput fromBundle(Bundle data, RemoteInputCompatBase.RemoteInput.Factory factory) { return factory.build(data.getString(KEY_RESULT_KEY), data.getCharSequence(KEY_LABEL), data.getCharSequenceArray(KEY_CHOICES), data.getBoolean(KEY_ALLOW_FREE_FORM_INPUT), data.getBundle(KEY_EXTRAS)); }
@TargetApi(Build.VERSION_CODES.KITKAT) public static String getExtended(Bundle extras, ViewGroup v) { Log.d(Constants.TAG, "NotificationUtils Getting message from extras.."); CharSequence[] lines = extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES); if(lines != null && lines.length > 0) { StringBuilder sb = new StringBuilder(); for (CharSequence msg : lines) // msg = msg.toString();//.replaceAll("(\\s+$|^\\s+)", "").replaceAll("\n+", "\n"); if (!TextUtils.isEmpty(msg)) { sb.append(msg.toString()); sb.append('\n'); } return sb.toString().trim(); } CharSequence chars = extras.getCharSequence(Notification.EXTRA_BIG_TEXT); if(!TextUtils.isEmpty(chars)) return chars.toString(); else if(!VersionUtils.isJellyBeanMR2()) return getExtended(v); else return getMessage(extras); }
@Override public final void onRestoreInstanceState(@NonNull final Bundle savedInstanceState) { setItemColor(savedInstanceState.getInt(ITEM_COLOR_EXTRA)); CharSequence[] items = savedInstanceState.getCharSequenceArray(ITEMS_EXTRA); if (items != null) { setItems(items, null); } else { boolean[] checkedItems = savedInstanceState.getBooleanArray(CHECKED_ITEMS_EXTRA); CharSequence[] singleChoiceItems = savedInstanceState.getCharSequenceArray(SINGLE_CHOICE_ITEMS_EXTRA); if (singleChoiceItems != null) { int checkedItem = checkedItems != null ? ArrayUtil.indexOf(checkedItems, true) : 0; setSingleChoiceItems(singleChoiceItems, checkedItem, null); } else { CharSequence[] multiChoiceItems = savedInstanceState.getCharSequenceArray(MULTI_CHOICE_ITEMS_EXTRA); if (multiChoiceItems != null) { setMultiChoiceItems(multiChoiceItems, checkedItems, null); } } } }
CharSequence[] lines = bun.getCharSequenceArray(Notification.EXTRA_TEXT_LINES); if (lines != null) { for (CharSequence line : lines) {
final CharSequence[] items = args.getCharSequenceArray(ARRAY_ITEMS);
CharSequence[] bluetoothEntries = msg.getData().getCharSequenceArray(OpenFitIntent.EXTRA_BLUETOOTH_ENTRIES); CharSequence[] bluetoothEntryValues = msg.getData().getCharSequenceArray(OpenFitIntent.EXTRA_BLUETOOTH_ENTRIES_VALUES); Intent i = new Intent(OpenFitIntent.INTENT_UI_BT); i.putExtra(OpenFitIntent.INTENT_EXTRA_MSG, bluetoothDevicesList);
CharSequence[] lines = bundle.getCharSequenceArray(Notification.EXTRA_TEXT_LINES); if ((lines != null) && (lines.length > 0)) { text = lines[Math.min(lines.length - 1, 0)].toString();