List of utility methods to do Context Get
String | getExternalCacheDir(Context context) get External Cache Dir if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { File f1 = context.getExternalCacheDir(); if (f1 != null) { return f1.getPath(); } else { return null; } else { ... |
File | getExternalCacheDir(Context context) get External Cache Dir final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); |
File | getExternalCacheDir(Context context) get External Cache Dir if (hasExternalCacheDir()) { return context.getExternalCacheDir(); final String cacheDir = "/Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); |
Typeface | getFAFont(Context context) get FA Font Typeface tf = Typeface.createFromAsset(context.getAssets(),
font_awesome);
return tf;
|
List | getFiles(Context context, String ext) get Files File dir = context.getFilesDir(); final List<File> files = new ArrayList<File>(); File[] subFiles = dir.listFiles(); if (subFiles != null) { for (File file : subFiles) { if (file.isFile() && file.getName().endsWith(ext)) { files.add(file); return files; |
String | getFromAssets(Context con, String fileName) get From Assets String result = ""; try { InputStream in = con.getResources().getAssets().open(fileName); int lenght = in.available(); byte[] buffer = new byte[lenght]; in.read(buffer); result = EncodingUtils.getString(buffer, "UTF-8"); } catch (Exception e) { ... |
Uri | getHelpUrl(Context context, String s) get Help Url if (TextUtils.isEmpty(s)) throw new IllegalArgumentException( "getHelpUrl(): fromWhere must be non-empty"); String s1 = "http://www.google.com/support/mobile/?hl=%locale%"; if (s1.contains("%locale%")) { Locale locale = Locale.getDefault(); s1 = s1.replace( "%locale%", ... |
String | getImei(Context context, String imei) get Imei TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
imei = telephonyManager.getDeviceId();
return imei;
|
List | getInstalleApps(Context mContext) get Installe Apps Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); return mContext.getPackageManager().queryIntentActivities( mainIntent, 0); |
LayoutInflater | getInstance(Context context) get Instance if (mInstance == null) mInstance = LayoutInflater.from(context); return mInstance; |