Check android device has camera or not

by Mohan 2014-08-20 17:53:01

check android device has camera or not

The below code can be used to find whether an android has camera or not.
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");
}
565
like
0
dislike
0
mail
flag

You must LOGIN to add comments