native.showAlert: Order of buttons different on devices

Hi!

I created a simple dialog using native.showAlert.

The first answer to the dialog is a button with “Yes”, the other with “No”. Both are of course declared in a table.

Now the same code produces different results on different devices:

On a smartphone with Android 2.3.5 the order is correct, like defined in the code.

On a tablet with Android 4.1.2 the order is wrong, “No” comes first and then “Yes”.

Same thing in windows simulator, though this is not a problem.

But it is annoying on devices and can harm user experience, especially if he quits the app by accident, because he expected the “Yes” to come first.

Thx for your information!

This is by Google’s design.  Android OS version 3.0 and above shows the alert dialog button order in right-to-left order now.  So, the Cancel or No button is now expected to be on the left side and the OK or Yes button on the right.  You can see examples of this on Google’s website here…

   http://developer.android.com/guide/topics/ui/dialogs.html

From a user experience stand-point, the button order matches how it is shown in other apps’ alert dialogs on the same device, and that’s what is most important.

Ok, thx!

This is by Google’s design.  Android OS version 3.0 and above shows the alert dialog button order in right-to-left order now.  So, the Cancel or No button is now expected to be on the left side and the OK or Yes button on the right.  You can see examples of this on Google’s website here…

   http://developer.android.com/guide/topics/ui/dialogs.html

From a user experience stand-point, the button order matches how it is shown in other apps’ alert dialogs on the same device, and that’s what is most important.

Ok, thx!

Hi Joshua,

I don’t believe what you are saying is correct.

Fundamentally it doesn’t even make sense, because an alert can have any number of buttons labelled as anything.  And these also appear in random order.

Just in case there was some sort of logic that looked at the labels of the button, I switched the ‘yes’/‘no’ buttons around in my code to be ‘no’/‘yes’, and as I expected it also reversed the order in the app on my phone to be ‘yes’/‘no’.

It would seem to me that the order of buttons is limited by the random nature which elements are retrieved from a table, unless they’re retrieved in numeric array index order.  A bug in Corona’s code…

Thoughts?

thanks

It’s definitely not random.  What I mentioned above is true.

On Android 2.x, the button order is left-to-right.

On Android 3.x and above, Google reversed the button order from right-to-left.

In both cases, Google expects you to put the primary/positive button text first in the list.  This way it’ll appear on the left side of the dialog on Android 2.x… and on the right side of the dialog on Android 3.x and above.  If you observe the alert dialog behavior for the built-in Google made apps between Android 2.x and 4.x devices, you’ll see that Google did in fact reverse the button placement order.  So, your dialog should appear as [Yes][No] on Android 2.x (Microsoft Windows standard ordering) and [No][Yes] on Android 3.x/4x (Apple’s standard ordering).  That is, you would never change the order of your button text in the list.  Android reverses the order for you.  And you’ll want this behavior so that your alert dialog’s buttons are in the same consistent ordering as all other apps on the end-user’s device.

The only other point of interest is when you are displaying 4 or more buttons.  In that case,  the buttons are shown top-to-bottom on all Android OS versions.

Hi Joshua,

Thanks for the clarification, I understand what you mean now

regards

Hi Joshua,

I don’t believe what you are saying is correct.

Fundamentally it doesn’t even make sense, because an alert can have any number of buttons labelled as anything.  And these also appear in random order.

Just in case there was some sort of logic that looked at the labels of the button, I switched the ‘yes’/‘no’ buttons around in my code to be ‘no’/‘yes’, and as I expected it also reversed the order in the app on my phone to be ‘yes’/‘no’.

It would seem to me that the order of buttons is limited by the random nature which elements are retrieved from a table, unless they’re retrieved in numeric array index order.  A bug in Corona’s code…

Thoughts?

thanks

It’s definitely not random.  What I mentioned above is true.

On Android 2.x, the button order is left-to-right.

On Android 3.x and above, Google reversed the button order from right-to-left.

In both cases, Google expects you to put the primary/positive button text first in the list.  This way it’ll appear on the left side of the dialog on Android 2.x… and on the right side of the dialog on Android 3.x and above.  If you observe the alert dialog behavior for the built-in Google made apps between Android 2.x and 4.x devices, you’ll see that Google did in fact reverse the button placement order.  So, your dialog should appear as [Yes][No] on Android 2.x (Microsoft Windows standard ordering) and [No][Yes] on Android 3.x/4x (Apple’s standard ordering).  That is, you would never change the order of your button text in the list.  Android reverses the order for you.  And you’ll want this behavior so that your alert dialog’s buttons are in the same consistent ordering as all other apps on the end-user’s device.

The only other point of interest is when you are displaying 4 or more buttons.  In that case,  the buttons are shown top-to-bottom on all Android OS versions.

Hi Joshua,

Thanks for the clarification, I understand what you mean now

regards