List of utility methods to do Context Get
String | getVersionName(Context context) get Version Name try { PackageInfo pInfo = context.getPackageManager().getPackageInfo( context.getPackageName(), 0); return pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { return "unknown"; |
int | getRawInteger(Context c, int resId) get Raw Integer return c.getResources().getInteger(resId);
|
Bitmap | getBitmapFromAssert(Context thisContext, String name) get Bitmap From Assert Bitmap bm = null; try { AssetManager am = thisContext.getAssets(); InputStream is = am.open(name); bm = BitmapFactory.decodeStream(is); is.close(); } catch (IOException e) { e.printStackTrace(); ... |
String | getString(Context context, int id) get String return context.getResources().getString(id);
|
String | getString(Context context, int resId, Map get String String s = context.getString(resId);
s = replaceString(s, replacement);
return s;
|
String | getStringFromXml(Context context, int resId) get String From Xml return context.getString(resId);
|
boolean | getBoolean(ContentValues alarm, String key) get Boolean Integer value = alarm.getAsInteger(key);
return (value != null) && (value != 0);
|
ContentValues | findOne(Context context, Uri uri) find One if (context == null) { Log.e(TAG, "findOne: cannot get context"); return null; Cursor cursor = context.getContentResolver().query(uri, null, null, null, null); if (cursor == null || !cursor.moveToFirst()) { Log.e(TAG, String.format("findOne: alarm %s not found", uri)); ... |
String | getCurrentTimeString(Context aContext, long aDate) Gets current date in string representation String pattern = ""; if (DateFormat.is24HourFormat(aContext)) { pattern = "dd-MM-yyyy HH:mm"; } else { pattern = "dd-MM-yyyy hh:mm a"; Calendar calendar = Calendar.getInstance(TimeZone .getTimeZone("UTC")); ... |
String | getCurrentTimeString(Context context) format the time according to the current locale and the user's 12-/24-hour clock preference return DateFormat.getTimeFormat(context).format(new Date()); |