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

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

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

Activity.getText介绍

暂无

代码示例

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param resId
 * @return
 * @see android.content.Context#getText(int)
 */
public final CharSequence getText(int resId) {
  return mActivity.getText(resId);
}

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

// Called when "Set as" is clicked.
private static boolean onSetAsClicked(MenuInvoker onInvoke,
                   final Activity activity) {
  onInvoke.run(new MenuCallback() {
    public void run(Uri u, IImage image) {
      if (u == null || image == null) {
        return;
      }

      Intent intent = Util.createSetAsIntent(image);
      activity.startActivity(Intent.createChooser(intent,
          activity.getText(R.string.setImage)));
    }
  });
  return true;
}

代码示例来源:origin: com.albedinsky.android/intents-core

/**
 */
@NonNull
@Override
public CharSequence getText(@StringRes int resId) {
  return mActivity.getText(resId);
}

代码示例来源:origin: com.albedinsky.android.support/support-intents-core

/**
 */
@NonNull
@Override
public CharSequence getText(@StringRes int resId) {
  return mActivity.getText(resId);
}

代码示例来源:origin: com.google.android/support-v4

/**
 * Set the title that will be used for the activity chooser for this share.
 *
 * @param resId Resource ID of the title string to use
 * @return This IntentBuilder for method chaining
 */
public IntentBuilder setChooserTitle(int resId) {
  return setChooserTitle(mActivity.getText(resId));
}

代码示例来源:origin: AriesHoo/FastLib

/**
 * @param msg
 * @return
 */
public FastLoadDialog setMessage(int msg) {
  mActivity = mReference.get();
  if (mActivity != null) {
    return setMessage(mActivity.getText(msg));
  }
  return this;
}

代码示例来源:origin: hylinux1024/Componentization

/**
 * Create an non-cancellable alert dialog builder.
 */
@CheckResult
public static Builder buildAlert(final Activity activity, final @StringRes int title, final @StringRes int message) {
  return buildAlert(activity, title != 0 ? activity.getText(title) : null, message != 0 ? activity.getText(message) : null);
}

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

/**
 * Set the title that will be used for the activity chooser for this share.
 *
 * @param resId Resource ID of the title string to use
 * @return This IntentBuilder for method chaining
 */
public IntentBuilder setChooserTitle(@StringRes int resId) {
  return setChooserTitle(mActivity.getText(resId));
}

代码示例来源:origin: DreaminginCodeZH/EffortlessPermissions

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
  Activity activity = getActivity();
  AlertDialog.Builder builder = new AlertDialog.Builder(activity, getTheme());
  if (mTitle != null) {
    builder.setTitle(mTitle);
  }
  if (mMessage != null) {
    builder.setMessage(mMessage);
  }
  CharSequence positiveButtonText = mPositiveButtonText;
  if (positiveButtonText == null) {
    positiveButtonText = activity.getText(android.R.string.ok);
  }
  builder.setPositiveButton(positiveButtonText, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      openAppDetails();
    }
  });
  if (mNegativeButtonText != null) {
    builder.setNegativeButton(mNegativeButtonText, null);
  }
  builder.setCancelable(mCancelable);
  return builder.create();
}

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

public static void showLabel(Activity activity, @IdRes int viewId, @StringRes int stringResId) {
  showText(activity.findViewById(viewId), activity.getText(stringResId).toString(), TextMediaType.UNKNOWN, false, false);
}

代码示例来源:origin: EspressifApp/EsptouchForAndroid

mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getText(android.R.string.cancel),
    new DialogInterface.OnClickListener() {
      @Override

代码示例来源:origin: grzegorznittner/chanu

@Override
protected boolean onItemSelected(MenuItem item) {
  Activity activity = (Activity) mActivity;
  if (item.getItemId() == R.id.action_cancel) {
    activity.setResult(Activity.RESULT_CANCELED);
    activity.finish();
    return true;
  } else if (item.getItemId() == R.id.action_details) {
    if (mAlbumSetDataAdapter.size() != 0) {
      if (mShowDetails) {
        hideDetails();
      } else {
        showDetails();
      }
    } else {
      Toast.makeText(activity,
          activity.getText(R.string.no_albums_alert),
          Toast.LENGTH_SHORT).show();
    }
    return true;
  } else {
    return false;
  }
}

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

private void syncUpgrade() {
  boolean success = false;
  try {
    progressLogger.logProgress(upgradeRequestor.getText(R.string.label_upgrading));
    success = doUpgrade();
  } finally {
    progressLogger.onComplete(success);
  }
}

代码示例来源:origin: gigabytedevelopers/FireFiles

intent = Intent.createChooser(intent, getActivity().getText(R.string.share_via));
if(Utils.isIntentAvailable(getActivity(), intent)) {
  startActivity(intent);

代码示例来源:origin: mathisdt/trackworktime

? "Location-based tracking was switched on already and is still enabled."
      : "You can now enable location-based tracking, just check \""
        + reference.getText(R.string.enableLocationBasedTracking) + "\"."), null);
reference.startActivity(messageIntent);

相关文章

Activity类方法