Check if Android Device has Camera via Code

by Sasikumar 2014-04-29 16:03:54

To check if a device has camera in android use the following code,
Context myContext = this;
PackageManager myPackageManager = myContext.getPackageManager();
TextView myTextView = (TextView) findViewById(R.id.infodisplay);
if (myPackageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
myTextView.setText("Camera is available");
} else {
myTextView.setText("Camera not available");
}
1175
like
0
dislike
0
mail
flag

You must LOGIN to add comments