We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1564

Summary: SDL has no function to open a screen keyboard on Android.
Product: SDL Reporter: Philipp Wiesemann <philipp.wiesemann>
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Android (All)   
Attachments: patch for keyboard open and close on Android
patch for SDL screen keyboard API and an implementation for Android

Description Philipp Wiesemann 2012-08-05 07:16:59 UTC
Created attachment 919 [details]
patch for keyboard open and close on Android

Hello,

there is currently no function to open a screen keyboard on Android.

Attached is a patch which adds two functions similar to the ones for iPhone in SDL_system.h. They show or hide a keyboard whose input ends up as key events inside the SDL application.
Opening and closing is asynchronous on Android which means that return values are not that useful (events would be more) and just tell if the request will be processed or not.
On devices with hardware keyboards nothing might show up. Therefore in the Android emulator the "keyboard support" property needs to be disabled for testing. 
The patch also adds a call to open a keyboard in tests/checkkeys.c because the iPhone keyboard is also requested there.
Comment 1 Ryan C. Gordon 2012-08-09 10:59:28 UTC
Unrelated to the rest of the patch, I'm wondering if we should avoid having SDL_AndroidKeyboardShow and SDL_iPhoneKeyboardShow...even "iPhone" is inaccurate, since it can be used on iPads and iPods now, too.

Unify this?

--ryan.
Comment 2 Philipp Wiesemann 2012-08-10 03:44:10 UTC
Created attachment 922 [details]
patch for SDL screen keyboard API and an implementation for Android

I created a new patch which adds five new function to the general SDL API. These are the four known (with different names for consistency) and an additional one to check if screen keyboard support is available at all. Windows Phones and other devices may then implement how much they support.
The patch again contains an implementation for Android (now also with toggle) but the "iPhone" version is unchanged.
Comment 3 Sam Lantinga 2012-08-11 08:45:00 UTC
This patch looks good.  I'll unify this with the iOS API later today.

Thanks!
Comment 4 Sam Lantinga 2012-08-11 10:19:31 UTC
I integrated your patch and switched over iOS to use that API.  Thanks! :)
http://hg.libsdl.org/SDL/rev/fa7eb111f994