Android recognize cell phone with keyboard or not?
In my android app, I want to detect the user's device 开发者_Python百科if the device has keyboard(like motorola milestone) and then show corresponding user interface. How do I do that?
http://developer.android.com/reference/android/content/res/Configuration.html
public int keyboard
The kind of keyboard attached to the device. One of: KEYBOARD_NOKEYS, KEYBOARD_QWERTY, KEYBOARD_12KEY.
If you're asking if there is a mechanism to allow detection of physical keyboard?
yes, Android does have the capability to notify applications of a keyboard open/close event.
You'll have to add detection of configuration changes to your activities. I believe there is a notification that is posted to the activity currently displayed that will indicate the keyboard state (or device configuration change).
http://developer.android.com/guide/topics/manifest/activity-element.html might give more insight in to what you're looking for.
精彩评论