Alert issue on Android

I am testing this piece of code on a Samsung Galaxy S with Android 2.1 and when I click on the “OK” button nothing happens.
(When I build for iphone everything is correct)

[code]
– Handler that gets notified when the alert closes
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
system.openURL( “http://www.google.com” )
elseif 2 == i then
system.openURL( “http://developer.anscamobile.com” )
end
end
end

– Show alert
local alert = native.showAlert( “Corona”, “Dream. Build. Ship.”,
{ “OK”, “Learn More” }, onComplete )

[code] [import]uid: 6661 topic_id: 4389 reply_id: 304389[/import]

This is a known issue–the values returned by event.action are incorrect on Android (internal bug 1620). Basically, event.index values are incorrect–they start at -1 and then decrement instead of increment. You may be able to work around the issue by “interpreting” these incorrect values in your app–e.g.,

if isAndroid then
if event.index == -1 then
– system.openURL(url_1)
elseif event.index == -2
– system.openURL(url_2)
end
end

About as hacky as you can get, so might prefer to create your own alert “dialog” using Corona display object/buttons.

Tim [import]uid: 8196 topic_id: 4389 reply_id: 13730[/import]

Thanks for your answer. Going to test this.
Was really going crazy with this as it works fine for the iphone. [import]uid: 6661 topic_id: 4389 reply_id: 13734[/import]

FYI,

On Android (2.2) and Corona (build 268 - 309), if I have a native.alert with two buttons, the left button on the alert returns a “cancelled” event.action and not a “clicked”. It will also return an event.index of zero.
[import]uid: 8891 topic_id: 4389 reply_id: 25954[/import]