package com.example.torch;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
ConstraintLayout layout;
CameraManager cameraManager;
String cameraId;
Boolean state=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
layout=findViewById(R.id.cl);
layout.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onClick(View view) {
if(state == false){
try{
cameraManager= (CameraManager) getSystemService(CAMERA_SERVICE);
cameraId=cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(cameraId,!state);
layout.setBackgroundResource(R.drawable.on);
state=true;
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
else {
try {
cameraManager= (CameraManager) getSystemService(CAMERA_SERVICE);
cameraId=cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(cameraId,!state);
layout.setBackgroundResource(R.drawable.off);
state=false;
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
}
});
}
}
DPI For Mobile Hi guys I am Chinnu you are watching 1010gaming in this blog we are going to see how to change the DPI of our mobile So first of all what is DPI DPI means dot per pixel. Dots per inch is a measure of spatial printing, video or image scanner dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch First open your mobile settings Then click about phone Find the build number and click a 7 time continuously and now you can see the developer option enabled below your screen Go back to again the settings Find the developer option in settings Then click the developer options and find Smallest Width Change the value to + 200 or + 400 by your mobile specification Don't play with this option this is very dangerous so be aware of using this.
Comments
Post a Comment
Thanks for your visit