List of usage examples for android.app Activity getContentResolver
@Override
public ContentResolver getContentResolver()
From source file:Main.java
public static void startAutoBrightness(Activity activity) { Settings.System.putInt(activity.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); }
From source file:Main.java
/** * Gets the dataCursor for ContactPicker and PhoneNumberPicker (used for Email and Phone). *///from w w w. j a v a2s .co m public static Cursor getDataCursor(String id, Activity activityContext, String[] dataProjection) { Cursor dataCursor = activityContext.getContentResolver().query(Data.CONTENT_URI, dataProjection, Data.CONTACT_ID + "=? AND (" + Data.MIMETYPE + "=? OR " + Data.MIMETYPE + "=?)", new String[] { id, Phone.CONTENT_ITEM_TYPE, Email.CONTENT_ITEM_TYPE }, null); return dataCursor; }
From source file:Main.java
public static boolean checkNotificationReadPermission(Activity activity) { String notiStr = Settings.Secure.getString(activity.getContentResolver(), "enabled_notification_listeners"); if (notiStr != null && !TextUtils.isEmpty(notiStr)) { final String[] names = notiStr.split(":"); for (String name : names) { ComponentName cn = ComponentName.unflattenFromString(name); if (cn != null) { if (activity.getPackageName().equals(cn.getPackageName())) { return true; }//from w w w . j a v a 2 s .com } } } return false; }
From source file:Main.java
public static Bitmap bitmapFromUri(Activity activity, Uri uri) throws IOException { return MediaStore.Images.Media.getBitmap(activity.getContentResolver(), uri); }
From source file:Main.java
public static int getScreenBrightness(Activity activity) { int nowBrightnessValue = 0; ContentResolver resolver = activity.getContentResolver(); try {//from w ww. j a v a 2 s . c o m nowBrightnessValue = Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS); } catch (Exception e) { e.printStackTrace(); } return nowBrightnessValue; }
From source file:Main.java
public static int getScreenBrightness(Activity activity) { int nowBrightnessValue = 0; ContentResolver resolver = activity.getContentResolver(); try {/*from w w w .j a v a 2 s. c o m*/ nowBrightnessValue = android.provider.Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS); } catch (Exception e) { e.printStackTrace(); } return nowBrightnessValue; }
From source file:Main.java
public static int GetAutorotateSetting(Activity activity) { int setting = 0; try {/*w w w . j a v a 2 s . c om*/ setting = Settings.System.getInt(activity.getContentResolver(), Settings.System.ACCELEROMETER_ROTATION); } catch (Exception e) { Log.i("RotationLockUtil", "Couldn't retrieve auto rotation setting: " + e.getMessage()); } return setting; }
From source file:Main.java
public static float getScreenBrightness(Activity activity) { float nowBrightnessValue = -1; ContentResolver resolver = activity.getContentResolver(); try {//w w w. ja v a2 s .c o m nowBrightnessValue = android.provider.Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS, -1); nowBrightnessValue /= 255; } catch (Exception e) { e.printStackTrace(); } return nowBrightnessValue; }
From source file:io.pivotal.arca.fragments.ArcaDispatcherFactory.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static ArcaDispatcher generateDispatcher(android.app.Activity activity) { final ContentResolver resolver = activity.getContentResolver(); final ArcaExecutor executor = new ArcaExecutor.DefaultArcaExecutor(resolver, activity); return new ArcaModernDispatcher(executor, activity, activity.getLoaderManager()); }
From source file:Main.java
public static int getScreenMode(Activity activity) { int screenMode = 0; try {// ww w. java 2s.co m screenMode = Settings.System.getInt(activity.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE); } catch (Exception localException) { } return screenMode; }