Four options in Android dialog?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Four options in Android dialog?
So I'm building a mobile app, and I've made use of the ask/answer dialog, which provides a simple native solution. However, I have a couple questions that have four options, and I discovered that the native android dialog appears to be limited to three options. Is there any way around this limitation?
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Four options in Android dialog?
Here's some code I use. It comes from a group that has a grc and a fld. It should get you started.
Code: Select all
put ("Nmae,Car,Date,Open,Closed,Top,Bottom") into pickList
replace comma with cr in pickList
put fld 1 of me into tCurrent
mobilePick pickList ,1,"Cancel"
put the result into ItemPicked
put line ItemPicked of pickList into theChoice
if ItemPicked is 0 OR (tCurrent = theChoice) then
exit to top
else
set the foregroundColor of fld 1 of me to 0,0,0
put line ItemPicked of pickList into fld 1 of me
end if
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: Four options in Android dialog?
No, with mobilePick there is no limits See : http://livecode.wikia.com/wiki/MobilePi ... Picker.pngyeldarb wrote: ↑Mon Jan 08, 2018 8:21 pmSo I'm building a mobile app, and I've made use of the ask/answer dialog, which provides a simple native solution. However, I have a couple questions that have four options, and I discovered that the native android dialog appears to be limited to three options. Is there any way around this limitation?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Four options in Android dialog?
Ok, so I can use the mobile picker as a solution. I have two related questions:
1. How do I identify the choices in the mobilePicker? There doesn't seem to be an option for a label or title in any of the examples, though on the wikia page there's a label ("Ringtones").
2. How do I initialize a list and/or array so that I don't have to duplicate it for the native answer dialog? In other words, the mobilePicker takes a return-delimted string ("chioce1" & cr & "choice2") but the native answer dialog takes a string separated by " or " as in "chioce1" or "choice2". I haven't found a way to replace or split/combine with " or " so that I can use a previously defined string for the buttons in the answer dialog.
1. How do I identify the choices in the mobilePicker? There doesn't seem to be an option for a label or title in any of the examples, though on the wikia page there's a label ("Ringtones").
2. How do I initialize a list and/or array so that I don't have to duplicate it for the native answer dialog? In other words, the mobilePicker takes a return-delimted string ("chioce1" & cr & "choice2") but the native answer dialog takes a string separated by " or " as in "chioce1" or "choice2". I haven't found a way to replace or split/combine with " or " so that I can use a previously defined string for the buttons in the answer dialog.
Re: Four options in Android dialog?
Probably with the do command and replace you can do it.yeldarb wrote: ↑Tue Jan 09, 2018 6:46 pm2. How do I initialize a list and/or array so that I don't have to duplicate it for the native answer dialog? In other words, the mobilePicker takes a return-delimted string ("chioce1" & cr & "choice2") but the native answer dialog takes a string separated by " or " as in "chioce1" or "choice2". I haven't found a way to replace or split/combine with " or " so that I can use a previously defined string for the buttons in the answer dialog.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: Four options in Android dialog?
Hi yeldarb,
You have to understand that Android OS handles lists differently than does iSO. This is not a LC restriction but the limitations of the Android OS. The code I posted above is your best bet for accomplishing this task.
You can dynamically populate the variable "pickList" in the code I posted to accomplish this and you are correct, there is no option for a label. You could however, set the top item is the list as a label and then, in your code, handle what happens if that item is tapped by the user, ie exit to top.
You have to understand that Android OS handles lists differently than does iSO. This is not a LC restriction but the limitations of the Android OS. The code I posted above is your best bet for accomplishing this task.
You can dynamically populate the variable "pickList" in the code I posted to accomplish this and you are correct, there is no option for a label. You could however, set the top item is the list as a label and then, in your code, handle what happens if that item is tapped by the user, ie exit to top.
1. How do I identify the choices in the mobilePicker? There doesn't seem to be an option for a label or title in any of the examples, though on the wikia page there's a label ("Ringtones").
Code: Select all
replace comma with " or " in pickList
2. How do I initialize a list and/or array so that I don't have to duplicate it for the native answer dialog? In other words, the mobilePicker takes a return-delimted string ("chioce1" & cr & "choice2") but the native answer dialog takes a string separated by " or " as in "chioce1" or "choice2". I haven't found a way to replace or split/combine with " or " so that I can use a previously defined string for the buttons in the answer dialog.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14