List of utility methods to do Context Get
Typeface | getTypeface(Context context, String name) Retrieve a type-face. context = context.getApplicationContext(); Log.d(TAG, "name=" + name); if (TYPEFACE_CACHE.containsKey(name)) { return TYPEFACE_CACHE.get(name); Typeface typeface = Typeface.createFromAsset(context.getAssets(), name); if (typeface != null) { ... |
String | getUserAgentString(Context context) get User Agent String if (userAgent == null) { try { Constructor<WebSettings> constructor = WebSettings.class .getDeclaredConstructor(Context.class, WebView.class); constructor.setAccessible(true); try { WebSettings settings = constructor.newInstance(context, ... |
String | getVersion(Context context) get Version String version = null; try { PackageInfo pInfo = context.getPackageManager().getPackageInfo( context.getPackageName(), PackageManager.GET_META_DATA); version = pInfo.versionName; } catch (NameNotFoundException e1) { return version; ... |
int | getVersionCode(Context mContext) get Version Code int versionCode = 0; try { versionCode = mContext.getPackageManager().getPackageInfo( mContext.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return versionCode; ... |
String | getVoiceSearchIMId(Context context) get Voice Search IM Id ComponentName voiceInputComponent = new ComponentName( "com.google.android.voicesearch", "com.google.android.voicesearch.ime.VoceInputMethdServce"); if (DEBUG) Log.i(TAG, "getVoiceSearchIMId(), Comonent name = " + voiceInputComponent.flattenToString() + ", id = " + voiceInputComponent.flattenToShortString()); return voiceInputComponent.flattenToShortString(); ... |