Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.selendroid.server.handler;
 
 import  io.selendroid.server.RequestHandler;
 import  io.selendroid.server.model.TouchScreen;
Allow the device's screen to be turned on or off.
public class SetScreenState extends RequestHandler {
  public SetScreenState(HttpRequest requestString mappedUri) {
    super(requestmappedUri);
  }
  public Response handle() throws JSONException {
    JSONObject payload = getPayload();
    int percentage = payload.getInt("brightness");
    float brightness = percentage / 100f;
    TouchScreen touch = getSelendroidDriver().getTouch();
    touch.setBrightness(brightness);
    return new SelendroidResponse(getSessionId(), "");
  }
New to GrepCode? Check out our FAQ X