Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ChoiceGroup/List +MultipleSelection+Selectin g only true Values

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello;
Can any one tell me how to Display selected items(true) from choice group/List as StringItem or in Textbox.I know if list/choice is implicit/Exclusive this can be done as
StringItem slection= new StringItem(cg.getString(cg.getSelectedIndex()));
but how can i achieve same thing with multiple selection displaying selection in textbox with /n separator. Please help!!
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at MIDP API, interface Choice:


public int getSelectedFlags(boolean[]�selectedArray_return)
Queries the state of a Choice and returns the state
of all elements in the
boolean array selectedArray_return. NOTE: this is a result parameter.
It must be at least as long as the size
of the Choice as returned by size().
If the array is longer, the extra elements are set to false.


so, I suggest you to try (suposing that your ChoiceGroup/List is named list):

Hope it helps,
Horaci Macias
 
chanakya khatri
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello horaci, Thanks a lot for reply. I got it working I used string buffer for appending result(discussed in java tips May 29, 2001).
Thanks a lot again for you help.
Cheers
Chanakya
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic