List of usage examples for android.app Activity getString
@NonNull public final String getString(@StringRes int resId)
From source file:com.andryr.guitartuner.Utils.java
public static void setupActivityTheme(Activity activity) { boolean dark = Preferences.getBoolean(activity, activity.getString(R.string.pref_dark_theme_key), false); if (dark) {/* w w w. ja v a 2 s .co m*/ activity.setTheme(R.style.AppThemeDark); } else { activity.setTheme(R.style.AppThemeLight); } }
From source file:Main.java
public static void selectImage(Activity activity, int i) { Intent intent = new Intent("android.intent.action.GET_CONTENT"); intent.setType("image/*"); activity.startActivityForResult(Intent.createChooser(intent, activity.getString(0x7f080083)), i); }
From source file:Main.java
/** * Function use through the app to show Toast information and finish current activity. * Function is called so often from background, that it's content is explicitly called from UIThread. * * @param activity - is current activity to finish * @param stringResourceId of text we show * @param handler to UIThread//from w w w .j av a 2 s . c o m */ public static void showToastAndFinishActivity(final Activity activity, final int stringResourceId, Handler handler) { handler.post(new Runnable() { @Override public void run() { Toast.makeText(activity, activity.getString(stringResourceId), Toast.LENGTH_SHORT).show(); activity.finish(); } }); }
From source file:org.gc.networktester.util.Util.java
public static AlertDialog createDialog(final Activity activity, int messageId) { return createDialog(activity, activity.getString(messageId)); }
From source file:org.sufficientlysecure.keychain.ui.util.Notify.java
public static Showable create(Activity activity, int textResId, Style style) { return create(activity, activity.getString(textResId), style); }
From source file:Main.java
public static void updateLeftTitle(Activity activity, int viewId, int resource) { View view = activity.findViewById(viewId); if (view == null) { return;/*w w w . j av a2 s.c o m*/ } if (view instanceof TextView) { ((TextView) view).setText(activity.getString(resource)); } }
From source file:org.sufficientlysecure.keychain.ui.util.Notify.java
public static Showable create(Activity activity, int textResId, int duration, Style style) { return create(activity, activity.getString(textResId), duration, style); }
From source file:org.liberty.android.fantastischmemo.utils.AMGUIUtility.java
public static void doProgressTask(final Activity activity, final int progressTitleId, final int progressMessageId, final ProgressTask task) { String progressTitle = activity.getString(progressTitleId); String progressMessage = activity.getString(progressMessageId); doProgressTask(activity, progressTitle, progressMessage, task); }
From source file:Main.java
public static ProgressDialog showProgressDialog(Activity context, int message, ProgressDialog.OnCancelListener cancelListener) { ProgressDialog mDialog = new ProgressDialog(context); mDialog.setCancelable(cancelListener != null); mDialog.setOnCancelListener(cancelListener); mDialog.setMessage(context.getString(message)); mDialog.setIndeterminate(true);//from ww w. j a va 2 s .c o m mDialog.show(); return mDialog; }
From source file:Main.java
public static void updateRightImgTitle(Activity activity, int viewId, int txtRes, int imgRes) { View view = activity.findViewById(viewId); if (view == null) { return;/*w w w . ja v a2 s . c o m*/ } if (view instanceof TextView) { view.setVisibility(View.VISIBLE); ((TextView) view).setText(activity.getString(txtRes)); Drawable drawable = activity.getResources().getDrawable(imgRes); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); ((TextView) view).setCompoundDrawables(null, drawable, null, null); } }