当前位置: 首页>>代码示例>>Java>>正文


Java SettingNotFoundException类代码示例

本文整理汇总了Java中android.provider.Settings.SettingNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java SettingNotFoundException类的具体用法?Java SettingNotFoundException怎么用?Java SettingNotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SettingNotFoundException类属于android.provider.Settings包,在下文中一共展示了SettingNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAccessibilitySettingsOn

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
public static boolean isAccessibilitySettingsOn(Context context, String serviceName) {
    int accessibilityEnabled = 0;
    boolean accessibilityFound = false;
    try {
        accessibilityEnabled = Settings.Secure.getInt(context.getApplicationContext().getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (SettingNotFoundException e) {
    }
    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
            splitter.setString(settingValue);
            while (splitter.hasNext()) {
                String accessabilityService = splitter.next();
                if (accessabilityService.equalsIgnoreCase(serviceName)) {
                    return true;
                }
            }
        }
    } else {
        // Log.v(TAG, "***ACCESSIBILIY IS DISABLED***");
    }

    return accessibilityFound;
}
 
开发者ID:waylife,项目名称:ViewDebugHelper,代码行数:27,代码来源:AccessibilityServiceHelper.java

示例2: onChange

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    // Retrieve the current system brightness value
    int currentBrightness;
    try {
        currentBrightness = (int) (((PlayerActivity)mContext).getWindow().getAttributes().screenBrightness*255f);
        if(currentBrightness<=0) //read global brightness setting when not set on window
            currentBrightness = Settings.System.getInt(mContentResolver, Settings.System.SCREEN_BRIGHTNESS);
    } catch (SettingNotFoundException e) {
        currentBrightness = DEFAULT_BACKLIGHT;
    }


    // The brightness has already been applied by the system, we just need to update the slider
    mSeekBar.setProgress(currentBrightness - MINIMUM_BACKLIGHT);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:BrightnessDialog.java

示例3: isGpsLocationEnabled

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
/**
 * Check if the GPS location is enabled on this device.
 *
 * @return <code>true</code> if the GPS location is enabled, <code>false</code> if it's disabled
 */
@SuppressWarnings("deprecation")
@SuppressLint("InlinedApi")
private boolean isGpsLocationEnabled() {
    int locationMode = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        try {
            locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);
        } catch (SettingNotFoundException e) {
            Log.e(LOG_TAG, "LocationMode option is not set.", e);
        }

        return locationMode != Settings.Secure.LOCATION_MODE_OFF;
    } else {
        String locationProviders;

        locationProviders = Settings.Secure.getString(context.getContentResolver(),
                                                      Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
        return !TextUtils.isEmpty(locationProviders);
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-service,代码行数:27,代码来源:AgentRequestHandler.java

示例4: GetCurrentBrightness

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
public int GetCurrentBrightness() {
    _logger.Debug("GetCurrentBrightness");

    ContentResolver contentResolver = _context.getContentResolver();
    int brightness = -1;

    try {
        Settings.System.putInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS_MODE,
                Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
        brightness = Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS);
    } catch (SettingNotFoundException e) {
        _logger.Error(e.toString());
    }

    return brightness;
}
 
开发者ID:GuepardoApps,项目名称:library_GuepardoAppsToolSet,代码行数:17,代码来源:DisplayController.java

示例5: isLocationEnabled

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
public boolean isLocationEnabled() {
    int locationMode = 0;
    String locationProviders;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
        try 
        {
        	locationMode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE);
        } 
        catch (SettingNotFoundException e) {
        }
        return locationMode != Settings.Secure.LOCATION_MODE_OFF;

    }
    else{
    	locationProviders = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
    	return !TextUtils.isEmpty(locationProviders);
    }
}
 
开发者ID:LedgerHQ,项目名称:u2f-ble-test,代码行数:20,代码来源:MainActivity.java

示例6: getActualState

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
@Override
public int getActualState(Context context) {
  try {
    current = Settings.System.getInt(context.getContentResolver(),
            Settings.System.SCREEN_OFF_TIMEOUT);
    current = current < mModes[mLastIndex] ?
            (current <= mModes[0] ? mModes[0] : current) : mModes[mLastIndex];
  } catch (final SettingNotFoundException e) { }

  if (current == mModes[mLastIndex]) {
    return STATE_ENABLED;
  } else if (current == mModes[0]) {
    return STATE_DISABLED;
  } else {
    return STATE_INTERMEDIATE;
  }
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:18,代码来源:TimeoutTracker.java

示例7: getActualState

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
@Override
public int getActualState(Context context) {
	try {
		auto = android.provider.Settings.System.getInt(
				context.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE);
		current = android.provider.Settings.System.getInt(
				context.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS);
		current = current < mModes[mLastIndex] ?
				(current <= mModes[0] ? mModes[0] : current) : mModes[mLastIndex];
	} catch (final SettingNotFoundException e) { }

	if (current == mModes[mLastIndex]) {
		return STATE_ENABLED;
	} else if (current == mModes[0]) {
		return STATE_DISABLED;
	} else {
		return STATE_INTERMEDIATE;
	}
}
 
开发者ID:sunnygoyal,项目名称:PowerToggles,代码行数:20,代码来源:BacklightTracker.java

示例8: D

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
public static boolean D(Context paramContext)
{
  int i1 = Build.VERSION.SDK_INT;
  boolean bool = false;
  ContentResolver localContentResolver;
  if (i1 >= 21) {
    localContentResolver = paramContext.getContentResolver();
  }
  try
  {
    int i2 = Settings.Secure.getInt(localContentResolver, "high_text_contrast_enabled");
    bool = false;
    if (i2 != 0) {
      bool = true;
    }
    return bool;
  }
  catch (Settings.SettingNotFoundException localSettingNotFoundException) {}
  return false;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:efj.java

示例9: 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;
}
 
开发者ID:jiaZengShen,项目名称:vlc_android_win,代码行数:25,代码来源:VideoPlayerActivity.java

示例10: 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;
    }

}
 
开发者ID:harmattan,项目名称:uds,代码行数:27,代码来源:QtSystemInfo.java

示例11: 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();
    }
}
 
开发者ID:firebirdberlin,项目名称:nightdream,代码行数:18,代码来源:LocationService.java

示例12: getLocationMode

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
@SuppressLint("InlinedApi")
private int getLocationMode() throws SettingNotFoundException {
	int apiLevel = Integer.valueOf(android.os.Build.VERSION.SDK_INT);
	if (apiLevel < 19) {
		LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		boolean isGpsEnabled = manager
				.isProviderEnabled(LocationManager.GPS_PROVIDER);
		if (isGpsEnabled) {
			return 3;
		} else {
			return 0;
		}
	} else {
		return Settings.Secure.getInt(getContentResolver(),
				Settings.Secure.LOCATION_MODE);
	}

}
 
开发者ID:callmesusheel,项目名称:yelli,代码行数:19,代码来源:YelliActivity.java

示例13: 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();
    }
}
 
开发者ID:firebirdberlin,项目名称:tinytimetracker,代码行数:20,代码来源:TinyTimeTracker.java

示例14: estimateEnergyLocal

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
private static Estimate estimateEnergyLocal(Context context,
		String methodName, float weight, boolean screenOn)
		throws NoHistoryException {
	// start with the local execution time
	Estimate result = estimateExecutionTimeLocal(context, methodName,
			weight);
	// assume that we use Max Power (Homer to the Max ;-)) for the CPU
	// during the execution time
	double power = ContextState.maxOf(context, "cpu.active");
	if (screenOn) {
		double screen = ContextState.valueOf(context, "screen.on");
		double screenFull = ContextState.valueOf(context, "screen.full");
		try {
			power += screen
					+ (Settings.System.getInt(context.getContentResolver(),
							Settings.System.SCREEN_BRIGHTNESS) / 255.0f)
					* (screenFull - screen);
		} catch (SettingNotFoundException e) {
			// assume half brightness
			power += screen + 0.5 * (screenFull - screen);
		}
	}
	result.average *= power;
	result.variance *= (power * power);
	return result;
}
 
开发者ID:interdroid,项目名称:cuckoo-library,代码行数:27,代码来源:Oracle.java

示例15: isLocationEnabled

import android.provider.Settings.SettingNotFoundException; //导入依赖的package包/类
/**
 * Gets the status of the location service.
 * 
 * @param context
 * @return
 */
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.KITKAT)
public static boolean isLocationEnabled(Context context) {
 int locationMode = 0;
 String locationProviders;

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
   	locationMode = Settings.Secure.LOCATION_MODE_OFF;
   	try {
   		locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);

       } catch (SettingNotFoundException e) {}

       return locationMode != Settings.Secure.LOCATION_MODE_OFF;

 }else{
       locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
       return !TextUtils.isEmpty(locationProviders);
 }
}
 
开发者ID:javocsoft,项目名称:javocsoft-toolbox,代码行数:27,代码来源:ToolBox.java


注:本文中的android.provider.Settings.SettingNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。