本文整理汇总了Java中android.provider.Settings.SettingNotFoundException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SettingNotFoundException.printStackTrace方法的具体用法?Java SettingNotFoundException.printStackTrace怎么用?Java SettingNotFoundException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.provider.Settings.SettingNotFoundException
的用法示例。
在下文中一共展示了SettingNotFoundException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBrightnessTouch
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
@TargetApi(android.os.Build.VERSION_CODES.FROYO)
private void initBrightnessTouch() {
float brightnesstemp = 0.6f;
// Initialize the layoutParams screen brightness
try {
if (AndroidUtil.isFroyoOrLater() &&
Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
mRestoreAutoBrightness = android.provider.Settings.System.getInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
} else {
brightnesstemp = android.provider.Settings.System.getInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
}
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = brightnesstemp;
getWindow().setAttributes(lp);
mIsFirstBrightnessGesture = false;
}
示例2: backLightStatus
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public int backLightStatus()
{
int backLight=0;
try {
backLight = Settings.System.getInt(QtApplication.mainActivity().getContentResolver(),Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
if((backLight<=BRIGHTNESS_ON) && (backLight>=BRIGHTNESS_DIM))
{
return 2;
}
else if((backLight>=BRIGHTNESS_OFF) && (backLight<=BRIGHTNESS_DIM))
{
return 1;
}
else if(backLight==BRIGHTNESS_OFF)
{
return 0;
}
else
{
return -1;
}
}
示例3: isLocationEnabled
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
private boolean isLocationEnabled() {
int locationMode = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
try {
locationMode = Secure.getInt(mContext.getContentResolver(), Secure.LOCATION_MODE);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return locationMode != Secure.LOCATION_MODE_OFF;
} else {
return isLocationEnabled_Deprecated();
}
}
示例4: isLocationEnabled
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public static boolean isLocationEnabled(Context context) {
int locationMode = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
try {
locationMode = Secure.getInt(context.getContentResolver(), Secure.LOCATION_MODE);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return locationMode != Secure.LOCATION_MODE_OFF;
} else {
String locationProviders = Secure.getString(context.getContentResolver(),
Secure.LOCATION_PROVIDERS_ALLOWED);
return !locationProviders.isEmpty();
}
}
示例5: initBrightnessSettings
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
private void initBrightnessSettings() {
conRes = getContentResolver();
if(isBrightness) {
try {
brightnessModePref = Settings.System.getInt(conRes, Settings.System.SCREEN_BRIGHTNESS_MODE);
if(brightnessModePref == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
Settings.System.putInt(conRes, Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}
else {
brightnessLevelPref = Settings.System.getInt(conRes, Settings.System.SCREEN_BRIGHTNESS);
}
Settings.System.putInt(conRes, Settings.System.SCREEN_BRIGHTNESS, 255);
}
catch(SettingNotFoundException e) {
Log.e(TAG, "Cannot access system brightness settings.");
e.printStackTrace();
}
}
}
示例6: initBrightnessTouch
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
private void initBrightnessTouch() {
float brightnesstemp = 0.01f;
try {
brightnesstemp = android.provider.Settings.System.getInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS) / 255.0f;
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = brightnesstemp;
getWindow().setAttributes(lp);
mIsFirstBrightnessGesture = false;
}
示例7: isAutoBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
private boolean isAutoBrightness() {
try {
return System.getInt(this.mContext.getContentResolver(), "screen_brightness_mode") == 1;
} catch (SettingNotFoundException e) {
e.printStackTrace();
return false;
}
}
示例8: canSideLoad
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public boolean canSideLoad(){
try {
int installNonMarketApps = Secure.getInt(context.getContentResolver(), Secure.INSTALL_NON_MARKET_APPS);
Logger.logd( "installNonMarketApps: " + installNonMarketApps, verbose, System.out);
return 1== installNonMarketApps;
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return true;
}
示例9: getScreenBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
/**
* 获取当前屏幕亮度,范围0-255
*
* @param context
* @return 屏幕当前亮度值
*/
public static int getScreenBrightness(Context context) {
int rightnessValue = 0;
try {
rightnessValue = Settings.System.getInt(
context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return rightnessValue;
}
示例10: isAutomicBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
/**
* 判断是否开启了自动亮度调节
*
* @param context
* @return
*/
public static boolean isAutomicBrightness(Context context) {
boolean automicBrightness = false;
try {
automicBrightness = Settings.System.getInt(
context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return automicBrightness;
}
示例11: displayBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public int displayBrightness ()
{
int backLight=0;
try {
backLight = Settings.System.getInt(QtApplication.mainActivity().getContentResolver(),Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
backLight=(backLight*100)/BRIGHTNESS_ON;
return backLight;
}
示例12: getRotationStatus
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
private int getRotationStatus(Context context)
{
int status = 0;
try
{
status = android.provider.Settings.System.getInt(context.getContentResolver(),
android.provider.Settings.System.ACCELEROMETER_ROTATION);
}
catch (SettingNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return status;
}
示例13: isAccessibiltiyEnable
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public static boolean isAccessibiltiyEnable(Context context) {
int i = 0;
try {
i = Secure.getInt(context.getContentResolver(), "accessibility_enabled");
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return i != 0;
}
示例14: isAutoBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public static boolean isAutoBrightness(Activity activity) {
boolean autoBrightness = false;
ContentResolver contentResolver = activity.getContentResolver();
try {
autoBrightness = Settings.System.getInt(contentResolver,
Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return autoBrightness;
}
示例15: getBrightness
import android.provider.Settings.SettingNotFoundException; //导入方法依赖的package包/类
public static int getBrightness(Activity activity) {
int brightValue = 0;
ContentResolver contentResolver = activity.getContentResolver();
try {
brightValue = Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return brightValue;
}