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 2415

Summary: Message Boxes aren't implemented on Android
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: videoAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: amaranth72, philipp.wiesemann
Version: HG 2.0   
Hardware: x86   
OS: Other   
Attachments: patch for messagebox on Android
patch for messagebox on Android (first fix)
patch for messagebox on Android (third version)

Description Ryan C. Gordon 2014-02-23 00:51:02 UTC
As noted here...

    http://lists.libsdl.org/pipermail/sdl-libsdl.org/2014-February/093338.html

...we don't have message boxes on Android at all. What would fixing this take? Surely there's some system-supplied popup thing?

--ryan.
Comment 1 Philipp Wiesemann 2014-02-24 00:02:55 UTC
Created attachment 1578 [details]
patch for messagebox on Android

I attached a patch for an incomplete implementation of the messagebox parts.

It was not tested on lots of devices yet and features a very fragile workaround to block the calling SDL thread while the dialog is handled on Android's UI thread. Although it works for testmessage.c I assume there are lot of situations were it may fail (standby, device rotation and other changes). Also not all flags and colors are implemented.

On the other hand most uses of the messagebox are to show an error on start and fragility (or working at all) may not matter there.
Comment 2 Gabriel Jacobo 2014-02-24 12:54:57 UTC
Thanks Philipp, I'll give this a try and let you know if I manage to break it.
Comment 3 Philipp Wiesemann 2014-02-25 21:09:21 UTC
Created attachment 1580 [details]
patch for messagebox on Android (first fix)

I updated the patch because of a JNI reference leak and dialogs not being canceled correctly.
Comment 4 Philipp Wiesemann 2014-09-12 20:36:05 UTC
Created attachment 1867 [details]
patch for messagebox on Android (third version)

I attached a new version of the patch because the old did not apply without conflicts. Also the button flags are now implemented.
Comment 5 Sam Lantinga 2014-09-13 09:15:40 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/6cd8e6b54f4d