I have two public voids in a class called Flashlight, these are:
public void turnOnFlashLight()
public void turnOffFlashLight()
How can I access these within Main Activity?
I've found many guides for using another class in MainActivity but not for accessing only a specific part (in this case I'm trying to turn the flashlight on or off).
This is he contents of MainActivity
public class MainActivity extends android.support.v7.app.ActionBarActivity {
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
httpserver();
public void httpserver() {
AsyncHttpServer server = new AsyncHttpServer();
java.util.List<WebSocket> _sockets = new java.util.ArrayList<WebSocket>();
server.listen(5000);
server.get("/flashon", new HttpServerRequestCallback() {
static final int CAMERA_PIC_REQUEST = 0;
public void onRequest(AsyncHttpServerRequest request, AsyncHttpServerResponse response) {
response.send("Ok");
Flashlight.turnOnFlashLight();
}
});
}
}
This is the Flashlight class https://stackoverflow.com/a/31289731/6696740
Thank you :)