2

I am new to Android. I want to detect, through code, whether my android device has QWERTY keypad and camera or not. Any suggestions?

1 Answer 1

2

For check keypad existence

Fetch the Configuration object using

Configuration config = getResources().getConfiguration();

...and then look at the keyboard field.

If they value of keyboard is not KEYBOARD_NOKEYS, the user has a hardware keyboard.

And for hardware Camera...

PackageManager pm = context.getPackageManager();

if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
}
2
  • for keypad check I used like System.out.println( config.keyboared);it returned 2 what it means? Jan 27, 2012 at 5:22
  • Look at KEYBOARD_* constants at this link. 2 stays for KEYBOARD_QWERTY, so you have QWERTY one
    – OleGG
    Jan 27, 2012 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.