in my android app i want a single button in which on 1st click brightness will be 10 , on 2nd click brightness will be 50 , on third click brightness will be 255 (full ) as the user click next it will back to 10 again how to code this i have tired this solution but only able to increase
private void getBrightness() {
try
{ int curBrightnessValue = 0 ;
curBrightnessValue = android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS);
if(curBrightnessValue >= 250 )
{
int SysBackLightValue = curBrightnessValue-30;
android.provider.Settings.System.putInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS,
SysBackLightValue);
curBrightnessValue=SysBackLightValue;
}
else if(curBrightnessValue <250)
{
int SysBackLightValue = curBrightnessValue+30;
android.provider.Settings.System.putInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS,
SysBackLightValue);
curBrightnessValue=SysBackLightValue;
}
please help me to resolve this issue