List of utility methods to do Context Get
String | getContactName(Context ctx, String phoneNumber) get Contact Name final ContentResolver cr = ctx.getContentResolver(); final Uri uri = Uri.withAppendedPath( PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); Cursor cursor = null; String contactName = phoneNumber; try { cursor = cr.query(uri, new String[] { PhoneLookup.DISPLAY_NAME }, null, null, ... |
Paint | getCornerLightPaint(Context context) get Corner Light Paint final Paint cornerPaint = new Paint(); cornerPaint.setColor(DEFAULT_CORNER_LIGHT_COLOR); cornerPaint.setStyle(Paint.Style.FILL); cornerPaint.setAntiAlias(true); return cornerPaint; |
float | getCornerOffset(Context context) get Corner Offset return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
DEFAULT_CORNER_OFFSET, context.getResources()
.getDisplayMetrics());
|
Paint | getCornerPaint(Context context) get Corner Paint final Paint cornerPaint = new Paint(); cornerPaint.setColor(DEFAULT_CORNER_COLOR); cornerPaint.setStyle(Paint.Style.FILL); cornerPaint.setAntiAlias(true); return cornerPaint; |
float | getCornerRadius(Context context) get Corner Radius return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
DEFAULT_CORNER_RADIUS, context.getResources()
.getDisplayMetrics());
|
RunningAppProcessInfo | getCurProcess(Context context) get Cur Process final int pid = android.os.Process.myPid(); final ActivityManager mActivityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final List<RunningAppProcessInfo> runningAppProcesses = mActivityManager .getRunningAppProcesses(); RunningAppProcessInfo result = null; for (ActivityManager.RunningAppProcessInfo appProcess : runningAppProcesses) { if (appProcess.pid == pid) { ... |
String | getCurrentHome(Context c) get Current Home Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = c.getPackageManager().resolveActivity( intent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo.activityInfo.packageName; |
HashMap | getCurrentLocationByName( Context context) public static HashMap HashMap<String, String> addressValues = new HashMap<String, String>(); double latitude = 0.0; double longtiude = 0.0; LocationManager locationManager = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); Location quickLocation = locationManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (quickLocation != null) { ... |
String | getCurrentSsid(Context context) get Current Ssid String ssid = null; ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { final WifiManager wifiManager = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); ... |
File | getDataFile(Context context, String fileName) get Data File File file = new File(getDatafilesStorageDirectory(context), fileName); return file; |