How to alter the deprecated Camera class in Android -
in previous way, flashlight feature used using camera class. entire camera , camera-related classes in android.hardware packages deprecated, should alternatively use other classes in android.hardware.camera2 package. traditionally, coded flashlight part this. // getting camera parameters private void getcamera() { if (camera == null) { try { camera = camera.open(); params = camera.getparameters(); } catch (runtimeexception e) { log.e("camera error. failed open. error: ", e.getmessage()); } } } /* * turning on flash */ private void turnonflash() { if (!isflashon) { if (camera == null || params == null) { return; } // play sound playsound(); params = camera.getparameters(); params.setflashmode(parameters.flash_mode_torch); camera.setparameters(params); camera.startpreview(); isflashon = true; // chang