How to detect if Android device has QWERTY keypad



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


Posted 2012-01-27T04:29:22.860

Reputation: 85



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)) {


Posted 2012-01-27T04:29:22.860

Reputation: 89 422

for keypad check I used like System.out.println( config.keyboared);it returned 2 what it means? – user1108995 – 2012-01-27T05:22:32.687

Look at KEYBOARD_* constants at this link. 2 stays for KEYBOARD_QWERTY, so you have QWERTY one

– OleGG – 2012-01-27T05:49:33.043