3.3.19

How to make a Flashlight app for android in Sketchware

To make a Flashlight app for android in Sketchware is very easy and simple. Just follow the steps given below:



Make a flashlight app for android in sketchware
Step 1 - Creat a new project Flashlight (you can also add flashlight with logo if you want), Drag Linear(V) to the screen, Set it's width to match_parent, Set gravity to center_horizontal and center_vertical.

Easiest way to make a flashlight app for android
 Drag ImageView to the screen as ImageView1, Set it's width and height to 100, and scale type to FIT_XY.

Step 2 - Go to option and using Image manager add two images ic_flash_on_black and ic_flash_off_black.

Make a flashlight app for android
Step 3 - Set ic_flash_off_black as the image of ImageView1 as shown in the picture.

Tutorial to make a flashlight app for android
Step 4 - Go to option, in Library manager switch on AppCompat and Design

Tutorial to make a Flashlight app for android
Step 5 - Add a Camera component.

How to make a Flashlight app for android without coding
Step 6 - Add two Variables: flashLightStatus and hasCameraFlash as shown in the picture.

Make a Flashlight app no coding
Step 7 - Add two MoreBlock: flashLightOn and flashLightOff.

Step 8 - Go to onCreate event, use add source directly block and put the following code:
hasCameraFlash = getPackageManager(). hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);

Step 9 - In More Block flashLightOn, use add source directly block and put the following code:
android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
String cameraId = cameraManager.getCameraIdList()[0]; cameraManager.setTorchMode(cameraId, true);
flashLightStatus = true; imageview1.setImageResource(R.drawable.ic_flash_on_black); } catch (android.hardware.camera2.CameraAccessException e) { }

Step 10 - In More Block flashLightOff, use add source directly block and put the following code:
android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
String cameraId = cameraManager.getCameraIdList()[0]; cameraManager.setTorchMode(cameraId, false);
flashLightStatus = false; imageview1.setImageResource(R.drawable.ic_flash_off_black); } catch (android.hardware.camera2.CameraAccessException e) { }

How to make app on smartphones no pc required
Step 11 - In ImageView1 onClick event, add blocks as shown in the picture above. 

Step 12 - Now run and flashlight app install is completed.

This is how you make a flashlight app for tablets and mobile phones.

For more sketchware tutorials pdf and sketchware help...

Go to my YouTube Channel to see the full Tutorial.