android.os.Bundle.getCharSequenceArray()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中android.os.Bundle.getCharSequenceArray()方法的一些代码示例,展示了Bundle.getCharSequenceArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getCharSequenceArray()方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getCharSequenceArray

Bundle.getCharSequenceArray介绍

暂无

代码示例

代码示例来源:origin: konmik/nucleus

when(bundle.getCharSequenceArray(anyString())).thenAnswer(get);

代码示例来源:origin: kayoSun/Tack

public CharSequence[] getCharSequences(String key,CharSequence[] defValue){
  if (mBundle != null) {
    return mBundle.getCharSequenceArray(key);
  }
  return  defValue;
}

代码示例来源:origin: evernote/android-state

public CharSequence[] getCharSequenceArray(Bundle state, String key) {
  return state.getCharSequenceArray(key + mBaseKey);
}

代码示例来源:origin: stackoverflow.com

// 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);
}

代码示例来源:origin: ashishbhandari/AndroidTabbedDialog

protected CharSequence[] getTabButtonText() {
  return getArguments().getCharSequenceArray(ARG_TAB_BUTTON);
}

代码示例来源:origin: stackoverflow.com

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");
   }

代码示例来源:origin: kingargyle/adt-leanback-support

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));
}

代码示例来源:origin: AmazMod/AmazMod

@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);
  }

代码示例来源:origin: michael-rapp/AndroidMaterialDialog

@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);
      }
    }
  }
}

代码示例来源:origin: stackoverflow.com

CharSequence[] lines = bun.getCharSequenceArray(Notification.EXTRA_TEXT_LINES);
if (lines != null) {
  for (CharSequence line : lines) {

代码示例来源:origin: xbmc/Kore

final CharSequence[] items = args.getCharSequenceArray(ARRAY_ITEMS);

代码示例来源:origin: jareddlc/OpenFit

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);

代码示例来源:origin: AmazMod/AmazMod

CharSequence[] lines = bundle.getCharSequenceArray(Notification.EXTRA_TEXT_LINES);
if ((lines != null) && (lines.length > 0)) {
  text = lines[Math.min(lines.length - 1, 0)].toString();

相关文章

Bundle类方法