當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。