android.content.Intent.getStringArrayListExtra()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(255)

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

Intent.getStringArrayListExtra介绍

暂无

代码示例

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

Intent i = getIntent();  
stock_list = i.getStringArrayListExtra("stock_list");

代码示例来源:origin: Tencent/tinker

public static ArrayList<String> getStringArrayListExtra(Intent intent, String name) {
  if (null == intent) {
    return null;
  }
  ArrayList<String> ret = null;
  try {
    ret = intent.getStringArrayListExtra(name);
  } catch (Exception e) {
    Log.e(TAG, "getStringExtra exception:" + e.getMessage());
    ret = null;
  }
  return ret;
}

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

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
    ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
    mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, matches));

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

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  switch (requestCode) {
    case VOICE_RECOGNITION_CODE: {
      if (resultCode == RESULT_OK && null != data) {
        ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
        searchInput.setText(text.get(0));
      }
      break;
    }
  }
}

代码示例来源:origin: lovetuzitong/MultiImageSelector

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if(requestCode == REQUEST_IMAGE){
    if(resultCode == RESULT_OK){
      mSelectPath = data.getStringArrayListExtra(MultiImageSelector.EXTRA_RESULT);
      StringBuilder sb = new StringBuilder();
      for(String p: mSelectPath){
        sb.append(p);
        sb.append("\n");
      }
      mResultText.setText(sb.toString());
    }
  }
}

代码示例来源:origin: GitLqr/LQRWeChat

@Override
public void init() {
  mSelectedTeamMemberAccounts = getIntent().getStringArrayListExtra("selectedMember");
}

代码示例来源:origin: donglua/PhotoPicker

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);
 if (resultCode == RESULT_OK &&
   (requestCode == PhotoPicker.REQUEST_CODE || requestCode == PhotoPreview.REQUEST_CODE)) {
  List<String> photos = null;
  if (data != null) {
   photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS);
  }
  selectedPhotos.clear();
  if (photos != null) {
   selectedPhotos.addAll(photos);
  }
  photoAdapter.notifyDataSetChanged();
 }
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (requestCode == MaterialSearchView.REQUEST_VOICE && resultCode == Activity.RESULT_OK) {
    ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
    if (matches != null && matches.size() > 0) {
      String searchWrd = matches.get(0);
      if (!TextUtils.isEmpty(searchWrd)) {
        mSearchView.setQuery(searchWrd, false);
      }
    }
    return;
  }
  super.onActivityResult(requestCode, resultCode, data);
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (resultCode != RESULT_OK) {
    return;
  }
  switch (requestCode) {
  case REQUEST_TO_PLACE_PICKER:
    if (data != null) {
      ArrayList<String> placeList = data.getStringArrayListExtra(PlacePickerWindow.RESULT_PLACE_LIST);
      if (placeList != null && placeList.size() > PlaceUtil.LEVEL_CITY) {
        tvDemoTabLeft.setText(StringUtil.getTrimedString(placeList.get(PlaceUtil.LEVEL_CITY)));
      }
    }
    break;
  default:
    break;
  }
}

代码示例来源:origin: k9mail/k-9

private void extractExtras() {
  Intent intent = getIntent();
  String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT_UUID);
  List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
  List<MessageReference> messagesToDelete = toMessageReferenceList(messageReferenceStrings);
  if (accountUuid == null) {
    throw new IllegalArgumentException(EXTRA_ACCOUNT_UUID + " can't be null");
  }
  if (messagesToDelete == null) {
    throw new IllegalArgumentException(EXTRA_MESSAGE_REFERENCES + " can't be null");
  }
  if (messagesToDelete.isEmpty()) {
    throw new IllegalArgumentException(EXTRA_MESSAGE_REFERENCES + " can't be empty");
  }
  Account account = getAccountFromUuid(accountUuid);
  if (account == null) {
    throw new IllegalStateException(EXTRA_ACCOUNT_UUID + " couldn't be resolved to an account");
  }
  this.account = account;
  this.messagesToDelete = messagesToDelete;
}

代码示例来源:origin: jaydenxiao2016/AndroidFire

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode == REQUEST_CODE && resultCode == RESULT_OK && data != null) {
    List<String> pathList = data.getStringArrayListExtra(ImgSelActivity.INTENT_RESULT);
    if(ninePicturesAdapter!=null){
      ninePicturesAdapter.addAll(pathList);
    }
  }
}

代码示例来源:origin: Naoki2015/CircleDemo

private void getIntentData() {
  startPos = getIntent().getIntExtra(INTENT_POSITION, 0);
  imgUrls = getIntent().getStringArrayListExtra(INTENT_IMGURLS);
  imageSize = (ImageSize) getIntent().getSerializableExtra(INTENT_IMAGESIZE);
}

代码示例来源:origin: GitLqr/LQRWeChat

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode == REQ_ADD_MEMBERS) {
    if (resultCode == RESULT_OK) {
      ArrayList<String> selectedIds = data.getStringArrayListExtra("selectedIds");
      mPresenter.addGroupMember(selectedIds);
    }
  } else if (requestCode == REQ_REMOVE_MEMBERS) {
    if (resultCode == RESULT_OK) {
      ArrayList<String> selectedIds = data.getStringArrayListExtra("selectedIds");
      mPresenter.deleteGroupMembers(selectedIds);
    }
  } else if (requestCode == REQ_SET_GROUP_NAME) {
    if (resultCode == RESULT_OK) {
      String groupName = data.getStringExtra("group_name");
      mOivGroupName.setRightText(groupName);
    }
  }
}

代码示例来源:origin: k9mail/k-9

private void deleteMessages(Intent intent, MessagingController controller) {
  Timber.i("NotificationActionService deleting messages");
  List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
  List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
  controller.deleteMessages(messageReferences, null);
}

代码示例来源:origin: TommyLemon/APIJSON

private void init() {
  llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
  llTopMenuWindowBg.setOnClickListener(this);
  Intent intent = getIntent();
  int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
  if (intentCodes == null || intentCodes.length <= 0) {
    intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
  } else {
    intentCodeList = new ArrayList<Integer>();
    for (int code : intentCodes) {
      intentCodeList.add(code);
    }
  }
  String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
  if (menuItems == null || menuItems.length <= 0) {
    nameList = intent.getStringArrayListExtra(INTENT_NAMES);
  } else {
    nameList = new ArrayList<String>(Arrays.asList(menuItems));
  }
  if (nameList == null || nameList.size() <= 0) {
    Log.e(TAG, "init   nameList == null || nameList.size() <= 0 >> finish();return;");
    finish();
    return;
  }
  adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);
  lvTopMenu = (ListView) findViewById(R.id.lvTopMenuWindowMenu);
  lvTopMenu.setAdapter(adapter);
  lvTopMenu.setOnItemClickListener(this);
}

代码示例来源:origin: TommyLemon/APIJSON

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (resultCode != RESULT_OK) {
    return;
  }
  switch (requestCode) {
  case REQUEST_TO_PLACE_PICKER:
    List<String> list = data == null ? null : data.getStringArrayListExtra(PlacePickerWindow.RESULT_PLACE_LIST);
    if (list == null || list.size() < 2) {
      CommonUtil.showShortToast(context, "请先选择地址哦~");
      CommonUtil.toActivity(context, PlacePickerWindow.createIntent(
          context, packageName, 2), REQUEST_TO_PLACE_PICKER, false);
      return;
    }
    String place = "";
    for (String s : list) {
      place += s;
    }
    tvEditTextInfoPlace.setText(place);
    break;
  default:
    break;
  }
}

代码示例来源:origin: k9mail/k-9

private void cancelNotifications(Intent intent, Account account, MessagingController controller) {
  if (intent.hasExtra(EXTRA_MESSAGE_REFERENCE)) {
    String messageReferenceString = intent.getStringExtra(EXTRA_MESSAGE_REFERENCE);
    MessageReference messageReference = MessageReference.parse(messageReferenceString);
    if (messageReference != null) {
      controller.cancelNotificationForMessage(account, messageReference);
    } else {
      Timber.w("Invalid message reference: %s", messageReferenceString);
    }
  } else if (intent.hasExtra(EXTRA_MESSAGE_REFERENCES)) {
    List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
    List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
    for (MessageReference messageReference : messageReferences) {
      controller.cancelNotificationForMessage(account, messageReference);
    }
  } else {
    controller.cancelNotificationsForAccount(account);
  }
}

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

@Test
public void putStringArrayListExtra_addsListToExtras() {
 Intent intent = new Intent();
 final ArrayList<String> strings = new ArrayList<>(Arrays.asList("hi", "there"));
 intent.putStringArrayListExtra("KEY", strings);
 assertThat(intent.getStringArrayListExtra("KEY")).isEqualTo(strings);
 assertThat(intent.getExtras().getStringArrayList("KEY")).isEqualTo(strings);
}

代码示例来源:origin: k9mail/k-9

private void markMessagesAsRead(Intent intent, Account account, MessagingController controller) {
  Timber.i("NotificationActionService marking messages as read");
  List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
  List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
  for (MessageReference messageReference : messageReferences) {
    String folderServerId = messageReference.getFolderServerId();
    String uid = messageReference.getUid();
    controller.setFlag(account, folderServerId, uid, Flag.SEEN, true);
  }
}

代码示例来源:origin: k9mail/k-9

private void archiveMessages(Intent intent, Account account, MessagingController controller) {
  Timber.i("NotificationActionService archiving messages");
  String archiveFolderName = account.getArchiveFolder();
  if (archiveFolderName == null ||
      (archiveFolderName.equals(account.getSpamFolder()) && K9.confirmSpam()) ||
      !isMovePossible(controller, account, archiveFolderName)) {
    Timber.w("Can not archive messages");
    return;
  }
  List<String> messageReferenceStrings = intent.getStringArrayListExtra(EXTRA_MESSAGE_REFERENCES);
  List<MessageReference> messageReferences = toMessageReferenceList(messageReferenceStrings);
  for (MessageReference messageReference : messageReferences) {
    if (controller.isMoveCapable(messageReference)) {
      String sourceFolderName = messageReference.getFolderServerId();
      controller.moveMessage(account, sourceFolderName, messageReference, archiveFolderName);
    }
  }
}

相关文章

Intent类方法