List of usage examples for android.content Context getString
@NonNull public final String getString(@StringRes int resId)
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized boolean getUseSystemProxySettings(Context context) { return new AppPreferences(context).getBoolean(context.getString(R.string.useSystemProxySettingsPreference), false);//from w w w .j av a2s . c o m }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized boolean getUseCustomProxySettings(Context context) { return new AppPreferences(context).getBoolean(context.getString(R.string.useCustomProxySettingsPreference), false);/* www .ja v a 2 s.co m*/ }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized boolean getUseProxyAuthentication(Context context) { return new AppPreferences(context).getBoolean(context.getString(R.string.useProxyAuthenticationPreference), false);//from ww w. j a v a 2s . c o m }
From source file:com.android.utils.JsonUtils.java
public static String readStringByResourceIdFromString(Context context, String resourceIdString) { int resourceId = getResourceIdFromString(context, resourceIdString); if (resourceId != 0) { return context.getString(resourceId); }/*from w ww .ja v a 2 s . c o m*/ return null; }
From source file:Main.java
public static String getApplicationName(Context context) { String appName = "Unnamed"; String versionName = "1.0"; try {//from w w w. j a v a2s. co m final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appName = context.getString(packageInfo.applicationInfo.labelRes); versionName = packageInfo.versionName; } catch (final NameNotFoundException e) { e.printStackTrace(); } return "WigwamLabs-" + appName.replaceAll("\\s", "") + "/" + versionName; }
From source file:Main.java
/** * helper class to retrieve a string by it's resource name * * @param ctx//from w w w. j a v a 2 s. c o m * @param resourceName * @return */ private static String getStringResourceByName(Context ctx, String resourceName) { String packageName = ctx.getPackageName(); int resId = ctx.getResources().getIdentifier(resourceName, "string", packageName); if (resId == 0) { return ""; } else { return ctx.getString(resId); } }
From source file:org.getlantern.firetweet.util.StatusCodeMessageUtils.java
public static String getTwitterErrorMessage(final Context context, final int code) { if (context == null) return null; final int resId = TWITTER_ERROR_CODE_MESSAGES.get(code, -1); if (resId > 0) return context.getString(resId); return null;/*from ww w . j av a 2s . c om*/ }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized String getCustomProxyHost(Context context) { return new AppPreferences(context) .getString(context.getString(R.string.useCustomProxySettingsHostPreference), ""); }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized String getCustomProxyPort(Context context) { return new AppPreferences(context) .getString(context.getString(R.string.useCustomProxySettingsPortPreference), ""); }
From source file:de.vanita5.twittnuker.util.StatusCodeMessageUtils.java
public static String getHttpStatusMessage(final Context context, final int code) { if (context == null) return null; final int res_id = HTTP_STATUS_CODE_MESSAGES.get(code, -1); if (res_id > 0) return context.getString(res_id); return null;/*from ww w. j av a 2s. co m*/ }