List of usage examples for android.content Context getString
@NonNull public final String getString(@StringRes int resId)
From source file:com.vel9studios.levani.popularmovies.util.AppUtils.java
public static String getPreferredSortOrder(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs.getString(context.getString(R.string.pref_sort_key), context.getString(R.string.pref_sort_default)); }
From source file:at.ac.uniklu.mobile.sportal.Studentportal.java
private static AppInfo getAppInfo(Context context) { AppInfo appInfo = new AppInfo(); appInfo.setAppName(context.getString(R.string.app_name)); try {/*from w w w .j a va 2s . c om*/ // get the app version infos PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); appInfo.setVersionCode(packageInfo.versionCode); appInfo.setVersionName(packageInfo.versionName); appInfo.setPackageName(packageInfo.packageName); } catch (NameNotFoundException e) { Log.d("SportalApplication", "could not retrieve version info"); Analytics.onError(Analytics.ERROR_VERSIONINFO, e); appInfo.setVersionCode(-1); appInfo.setVersionName("n/a"); } return appInfo; }
From source file:Main.java
/** * Returns a CharSequence containing a bulleted and properly indented list. * * @param leadingMargin//from w w w . ja v a2 s .c om * In pixels, the space between the left edge of the bullet and * the left edge of the text. * @param context * @param linesResIds * An array of string resource ids. Each string will be a * separate line/bullet-point. * @return */ public static CharSequence makeBulletListFromStringResources(int leadingMargin, Context context, int... linesResIds) { int len = linesResIds.length; CharSequence[] cslines = new CharSequence[len]; for (int i = 0; i < len; i++) { cslines[i] = context.getString(linesResIds[i]); } return makeBulletList(leadingMargin, cslines); }
From source file:com.saulcintero.moveon.osm.OSMHelper.java
public static OAuthProvider GetOSMAuthProvider(Context ctx) { return new CommonsHttpOAuthProvider(ctx.getString(R.string.osm_requesttoken_url), ctx.getString(R.string.osm_accesstoken_url), ctx.getString(R.string.osm_authorize_url)); }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized String getProxyUsername(Context context) { return new AppPreferences(context).getString(context.getString(R.string.useProxyUsernamePreference), ""); }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized String getProxyPassword(Context context) { return new AppPreferences(context).getString(context.getString(R.string.useProxyPasswordPreference), ""); }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized String getProxyDomain(Context context) { return new AppPreferences(context).getString(context.getString(R.string.useProxyDomainPreference), ""); }
From source file:com.github.michalbednarski.intentslab.browser.FetcherManager.java
static String[] getFetcherNames(Context context) { int count = FETCHER_REGISTRY.length; String[] fetcherNames = new String[count]; for (int i = 0; i < count; i++) { fetcherNames[i] = context.getString(FETCHER_REGISTRY[i].nameRes); }/*from w w w . j a va 2s. co m*/ return fetcherNames; }
From source file:com.vel9studios.levani.popularmovies.util.AppUtils.java
public static String getSortOrderQuery(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String sortOrder = prefs.getString(context.getString(R.string.pref_sort_key), context.getString(R.string.pref_sort_default)); if (sortOrder.equals(AppConstants.QUERY_SORT_TYPE_POPULARITY)) return MoviesContract.MoviesEntry.COLUMN_POPULARITY + " DESC"; else if (sortOrder.equals(AppConstants.QUERY_SORT_TYPE_VOTE)) return MoviesContract.MoviesEntry.COLUMN_VOTE_AVERAGE + " DESC"; return null;/*www .j ava 2 s . co m*/ }
From source file:com.psiphon3.psiphonlibrary.UpstreamProxySettings.java
public static synchronized boolean getUseHTTPProxy(Context context) { return new AppPreferences(context).getBoolean(context.getString(R.string.useProxySettingsPreference), false);/* w w w .ja v a 2s .c om*/ }