Maybe I’m missing something, but native.showAlert() isn’t working properly on Android. It shows the alert, but no matter what button I click, it doesn’t return the right index, so the actions in the callback function aren’t being triggered. Anyone have a fix for this? [import]uid: 8782 topic_id: 4001 reply_id: 304001[/import]
do you have some code to look at?
carlos
[import]uid: 24 topic_id: 4001 reply_id: 12230[/import]
I tried it with the sample code in the docs, just packaged it up, and it didn’t work. I changed the callback to show another alert with the index, but it doesn’t return the right one, and some of them are negative. Do I have to change anything for android? [import]uid: 8782 topic_id: 4001 reply_id: 12268[/import]
Hi NayGames,
I had noticed some issues with the Alert dialog, on both the iOS and the Android platform.
See this code,
native.showAlert("Go Back","At this point, go back where?","OK")
It works, but no matter what button you click, it will not work. Know why?? Because the input for the buttons is expecting a table. So the correct way to call this would be
native.showAlert("Go Back","At this point, go back where?",{"OK"})
Check your code and if this is the issue, then your problem is resolved. If it is something else, well… you need to post code if you require a solution.
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 4001 reply_id: 12361[/import]
My code is fine, the buttons are in a table. I copied and pasted the example code, tried it, and it didn’t work. I played around with it, and it still doesn’t work. Does anyone know how to fix this? [import]uid: 8782 topic_id: 4001 reply_id: 12670[/import]
can u post code?
carlos [import]uid: 24 topic_id: 4001 reply_id: 12671[/import]
Here’s all the code (it’s just the sample code, with an alert that shows the index returned after you click a button)
[lua]-- Handler that gets notified when the alert closes
local function onComplete( event )
native.showAlert(“alert test”,event.index, {“OK”})
if “clicked” == event.action then
local i = event.index
if 1 == i then
– Do nothing; dialog will simply dismiss
elseif 2 == i then
– Open URL if “Learn More” (the 2nd button) was clicked
system.openURL( “http://developer.anscamobile.com” )
end
end
end
– Show alert with five buttons
local alert = native.showAlert( “Corona”, “Dream. Build. Ship.”,
{ “OK”, “Learn More” }, onComplete )[/lua] [import]uid: 8782 topic_id: 4001 reply_id: 12674[/import]
Has anyone figured this one out? It’s the only thing holding me back from publishing my app for Android. (Well, I guess I could rewrite the stuff not using alerts…) [import]uid: 8782 topic_id: 4001 reply_id: 15269[/import]
Hello, bump this post becouse I have the same problem with Android.
Any idea ?
Regards.
Francisco. [import]uid: 11749 topic_id: 4001 reply_id: 17470[/import]
Hi Robert/Kari, Francisco
As I had replied earlier, and posted some sample code, now I do not know when you say you have issues, what you mean by that. I too have certain issues with Android, of a different type, but not with the showAlert. Here’s a video of one of my projects ported to corona running on an android device.
Physics kills the device totally. Here’s a video for you to see the native UI alert, the video is poor in quality coz I had to use the iSight from the mbp to display a preview in iMovie, then a screen capture app to capture the screen. The same shot with my iPhone4 was 78 MB 
here’s the link for you http://www.oz-apps.com/files/android-movie.mov to see that it works.
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 4001 reply_id: 17475[/import]
Hi,
Got the error, that is making it difficult for you to test, this. Since my code is not checking for any return codes. On my Android device, when you click OK, the value returned is 0 and when you click on Learn More, which returns -1 but does not open the webpage. However on the simulator, the results are different.
Hope that Helps,
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 4001 reply_id: 17476[/import]
Hi,
Got the error, that is making it difficult for you to test, this. Since my code is not checking for any return codes. On my Android device, when you click OK, the value returned is 0 and when you click on Learn More, which returns -1 but does not open the webpage. However on the simulator, the results are different.
Hope that Helps,
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 4001 reply_id: 17477[/import]
Hello, then native.showAlert have a wrong return codes and maybe its a bug ?
Someone from Ansca can drop some light ?
Regards.
Francisco. [import]uid: 11749 topic_id: 4001 reply_id: 17485[/import]
I have the same problem here. It simply does not work on the android device. Any light would be appreciated, especially considering how long this thread is. [import]uid: 28795 topic_id: 4001 reply_id: 22442[/import]
FWIW this is a longstanding issue of which we are aware, internal case 1620. [import]uid: 6787 topic_id: 4001 reply_id: 23524[/import]