android.app.Activity.getString()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(480)

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

Activity.getString介绍

暂无

代码示例

代码示例来源:origin: gzu-liyujiang/AndroidPicker

public ConfirmPopup(Activity activity) {
  super(activity);
  cancelText = activity.getString(android.R.string.cancel);
  submitText = activity.getString(android.R.string.ok);
}

代码示例来源:origin: commonsguy/cw-omnibus

public void setMessageByID(int messageID) {
 message = activity.getString(messageID);
}

代码示例来源:origin: commonsguy/cw-omnibus

public void setButtonNoByID(int buttonNoID) {
 buttonNo = activity.getString(buttonNoID);
}

代码示例来源:origin: commonsguy/cw-omnibus

public void setButtonYesByID(int buttonYesID) {
 buttonYes = activity.getString(buttonYesID);
}

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

@Override
protected void showProgressDialog() {
  String message = mActivity.getString(R.string.manage_accounts_moving_message);
  mProgressDialog = ProgressDialog.show(mActivity, null, message, true);
}

代码示例来源:origin: yarolegovich/SlidingRootNav

private ViewGroup getContentView() {
  if (contentView == null) {
    contentView = (ViewGroup) activity.findViewById(android.R.id.content);
  }
  if (contentView.getChildCount() != 1) {
    throw new IllegalStateException(activity.getString(R.string.srn_ex_bad_content_view));
  }
  return contentView;
}

代码示例来源:origin: TeamNewPipe/NewPipe

@Override
protected void onPreExecute() {
  super.onPreExecute();
  Activity activity = getActivity();
  if (activity != null) {
    // Create dialog
    progressDialog = new ProgressDialog(activity);
    progressDialog.setCancelable(false);
    progressDialog.setMessage(activity.getString(R.string.msg_wait));
    progressDialog.show();
  }
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

/**
 * 设置顶部标题栏取消按钮文字
 */
public void setCancelText(@StringRes int textRes) {
  setCancelText(activity.getString(textRes));
}

代码示例来源:origin: pockethub/PocketHub

/**
   * Show the message with the given resource id in a {@link Toast}
   * <p>
   * This method may be called from any thread
   *
   * @param activity
   * @param resId
   */
  public static void show(final Activity activity, final int resId) {
    if (activity == null) {
      return;
    }

    show(activity, activity.getString(resId));
  }
}

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

public String getAlias() {
  String alias = mSelection.getText().toString();
  if (alias.equals(mActivity.getString(R.string.client_certificate_spinner_empty))) {
    return null;
  } else {
    return alias;
  }
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

/**
 * 设置顶部标题栏确定按钮文字
 */
public void setSubmitText(@StringRes int textRes) {
  setSubmitText(activity.getString(textRes));
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

/**
 * 设置顶部标题栏标题文字
 */
public void setTitleText(@StringRes int textRes) {
  setTitleText(activity.getString(textRes));
}

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

@Override
protected void showProgressDialog() {
  String title = mActivity.getString(R.string.settings_import_activate_account_header);
  int passwordCount = (mOutgoingPassword == null) ? 1 : 2;
  String message = mActivity.getResources().getQuantityString(
             R.plurals.settings_import_setting_passwords, passwordCount);
  mProgressDialog = ProgressDialog.show(mActivity, title, message, true);
}

代码示例来源:origin: RobotiumTech/robotium

/**
 * Returns a localized string.
 * 
 * @param resId the resource ID for the string
 * @return the localized string
 */
public String getString(int resId)
{
  Activity activity = getCurrentActivity(false);
  if(activity == null){
    return "";
  }
  return activity.getString(resId);
}

代码示例来源:origin: RobotiumTech/robotium

/**
 * Returns a localized string
 * 
 * @param id the resource ID for the string
 * @return the localized string
 */
public String getString(int id)
{
  Activity activity = activityUtils.getCurrentActivity(false);
  if(activity == null){
    return "";
  }
  return activity.getString(id);
}

代码示例来源:origin: gzu-liyujiang/AndroidPicker

@Override
protected void setContentViewBefore() {
  boolean isPickFile = mode == FILE;
  setCancelVisible(!isPickFile);
  if (isPickFile) {
    setSubmitText(activity.getString(android.R.string.cancel));
  } else {
    setSubmitText(activity.getString(android.R.string.ok));
  }
}

代码示例来源:origin: nickbutcher/plaid

@NonNull
private DribbbleShotHolder createDribbbleShotHolder(ViewGroup parent) {
  final DribbbleShotHolder holder = new DribbbleShotHolder(
      layoutInflater.inflate(R.layout.dribbble_shot_item, parent, false),
      initialGifBadgeColor,
      (view, position) -> {
        Intent intent = ActivityHelper.intentTo(Activities.Dribbble.Shot.INSTANCE);
        intent.putExtra(Activities.Dribbble.Shot.EXTRA_SHOT_ID,
            getItem(position).getId());
        setGridItemContentTransitions(view);
        ActivityOptions options =
            ActivityOptions.makeSceneTransitionAnimation(host,
                Pair.create(view, host.getString(R.string.transition_shot)),
                Pair.create(view, host.getString(R.string
                    .transition_shot_background)));
        host.startActivityForResult(intent, REQUEST_CODE_VIEW_SHOT, options.toBundle());
        return Unit.INSTANCE;
      });
  return holder;
}

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

@Test
public void shouldUseApplicationLabelFromManifestAsTitleForActivity() throws Exception {
 activity = Robolectric.setupActivity(LabelTestActivity1.class);
 assertThat(activity.getTitle()).isNotNull();
 assertThat(activity.getTitle().toString()).isEqualTo(activity.getString(R.string.app_name));
}

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

@Test
public void shouldUseActivityLabelFromManifestAsTitleForActivityWithShortName() throws Exception {
 activity = Robolectric.setupActivity(LabelTestActivity3.class);
 assertThat(activity.getTitle()).isNotNull();
 assertThat(activity.getTitle().toString()).isEqualTo(activity.getString(R.string.activity_name));
}

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

@Test
public void shouldUseActivityLabelFromManifestAsTitleForActivity() throws Exception {
 activity = Robolectric.setupActivity(LabelTestActivity2.class);
 assertThat(activity.getTitle()).isNotNull();
 assertThat(activity.getTitle().toString()).isEqualTo(activity.getString(R.string.activity_name));
}

相关文章

Activity类方法