RadioButton listener

I am a beginning programmer and have tried to solve my problem in the pursuit of learning. However, I have spent a bit of time on this one area and was wondering could someone help point me in the right direction.

To prepare the ground, I have two RadioButtonFields in a RadioButtonGroup. The RadioButtonGroup is set within a layout manager so that I can view the RCW on the screen I would. In any case, I've coded some functions for the first button or the 0 index. I've not coded anything for the second button or index 1. I try to have the index 1 display a dialog.alert and then reset choices so that a user can go back and select index 0 for now.

When the index 1 is selected, the dialog.alert shows, but when "ok" is selected, and I'm going to select index 0, I get a JVM error 104, IllegalStateException. Can someone watch what I coded and help me to implement what I'm trying to do the right way? It will be more appreciated.

RadioButtonLayout rblType = new RadioButtonLayout();final RadioButtonGroup rbgType = new RadioButtonGroup();

RadioButtonField rbfOne = new RadioButtonField(" One", rbgType, false);rblType.add(rbfOne);

RadioButtonField rbfTwo = new RadioButtonField(" Two", rbgType, false);rblType.add(rbfTwo);vfmMain.add(rblType);

rbgType.setChangeListener(new FieldChangeListener() {   public void fieldChanged(Field field, int context) {      if (rbgType.getSelectedIndex() == 0) {      add(vfmBody1);      }      if (rbgType.getSelectedIndex() == 1) {             if (vfmBody1.isVisible() == true) {           delete(vfmBody1);

              if (vfmBody2.isVisible() == true) {        delete(vfmBody2);          }       }       Dialog.alert("Feature unavailable at this time. This will be implemented in a " +     "future release.");

       rbgType.setChangeListener(null);       rbgType.setSelectedIndex(0);   }  }});

You will need to make the update screen in a block that is described here:

How - to upgrade a screen on the main event Thread
Article number: DB-00136

http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

Tags: BlackBerry Developers

Similar Questions

  • Flex 3 RadioButton group validation

    I'm new with Flex, but I found that it is very versatile.

    Many of my projects to date have been the construction of forms for different uses.

    I stumbled upon this one problem with the forms.

    RadioButton and Radiobutton groups do not have a validator. I just want to be able to make the required radiobuttongroup until someone passes on the next panel. But after a lot of research on the internet and hours trying to find an easy way, I am not able to.

    Anyone know of a simple way?

    < mx:Script >
    <! [CDATA]

    Import mx.validators.StringValidator;
    Import mx.validators.Validator;
    Import mx.events.ValidationResultEvent;
    Import mx.controls.Alert;
    Import mx.validators.NumberValidator;
    Import mx.core.Container;

    private function validateInfo (): void
    {
    var validator: Array = [serialNumberValidator, internetConnectionRadioGroupValidator];
    Var errors: Array = Validator.validateAll (validators).
    var errorMessages:Array = [];

    If (Errors.Length > 0)
    {

    for each (var error: ValidationResultEvent errors)
    {
    var errorField:String = Panel (error.currentTarget.source.parent) .label;
    errorMessages.push (errorField + "" + error.message);
    }

    Alert.Show(errorMessages.Join("\n\n"), "There was problems with your form.");
    }
    If (Errors.Length < 1)
    {
    informationAboutYouPanel.visible = false; howYouUseHomerPanel.visible = true
    }

    }
    []] >
    < / mx:Script >

    <! - validators - >

    < mx:StringValidator id = "serialNumberValidator".
    source = "{serialNumberTextInput}".
    property = "text".
    requiredFieldError = "Please enter a serial number.
    minLength = "1" / >


    < mx:Validator id = "internetConnectionRadioGroupValidator".
    Source = "{internetConnectionRadioGroup}" = "selectedValue" property
    triggerEvent = 'change '.
    requiredFieldError = "option must be selected."
    listener = "{informationAboutYouPanel}" / >

    <!-information about control panel->

    If this post answers your question or assistance, please mark it as such.

    This code should answer your question:

    
    
      
        
      
      
      
      
      
      
      
    
    
  • RadioButton in 1st line causing problems DataGrid

    I have a DataGrid with radio buttons in a column using itemRenderer. The data grid resides on a TitleWindow that is created and hopped up whenever the user clicks a button. The dataProvider of the DataGrid is an ArrayCollection collection, and option buttons are selected or not based on a Boolean value in every item in the collection ArrayCollection when the window and the DataGrid is displayed. If the user clicks a RadioButton that is different in the DataGrid control, then the elements of the ArrayCollection collection are updated with the new Boolean values.

    The problem is with the RadioButton control in the first row with its selected value. With radio buttons in all the other lines, when the TitleWindow and DataGrid are displayed, correct RadioButton is selected depending on the Boolean value of the item in the collection ArrayCollection. But if RadioButton from the first line is one that should be selected, it is not. I created a listener for the on option buttons valueCommit event, and the results are interesting: valueCommit for radio buttons in all lines not to mention that the first is triggered only once, with the selected value is true. But if the RadioButton control in the first line is one that should be selected, valueCommit is shot 5 times, all first 3 reports the value selected as true and last 2 times reported to be set to false.

    Any help on this would be greatly appreciated. A similar bug has been reported , but it provides no work around.

    Solution: instead of using radio buttons as the itemRenderer, I used an image that works much more clean and which does not produce a so unpredictable behavior.

  • How can I listen to an album in order?

    I can't find a way to turn off shuffle when you listen to an album.  I feel pretty stupid... I must be missing something * really * obvious.

    in OS X

    Shuffle on

    Shuffle off

    in OS 9.3.5 is this

  • I can't download any music for listening offline more

    All of a sudden, I can't download any music for offline listening more.

    Icon to download is available but when clicking top is transformed into a turning circle around and it stays like that... days.

    Do I did wrong?

    Thanks for the comments,

    Peter

    Hi Peter Meylaerts.

    Welcome to the communities of Apple Support!

    We understand that you are no longer able to download music in Apple's music for the way you expect listen offline. We have a few different troubleshooting suggestions to suggest this behavior.

    First, we recommend that you close the application completely music. The following article explains this process:

    Force an application to close on your iPhone, iPad or iPod touch - Apple Support

    The music has been closed, restart your iPhone:

    Restart your iPhone, iPad or iPod touch - Apple Support

    If the problem persists, let us know if you experience this problem when you are connected to the Wi - Fi and cell phone. Have you noticed other issues with your iPhone on the network?

    See you soon!

  • Listen to concerto sequentially

    Problem: I want to listen to the Beethoven Concerto in 3 movements.    The program plays the first movement, but then moves to the 3rd movement or randomly selects another piece of music that I didn't.  I want to listen to the first movement, then the second movement, then the third movement.   This is impossible.   Any solution?

    Hey t5dashc,

    Thank you for being a part of the communities of Apple Support.

    I see your message you are trying to play your music in a sequential order, but it is up to chance.  This behavior is indicative of the shuffle option is enabled.  We will shuffle off in the music app and try to play the music again:

    When you play a song, you see a player at the bottom of the screen. You can continue to browse other titles to find the next perfect song.

    Press or drag upward on the drive down to see the current reading and controls screen.

    Then stir and repeat

    Also on the playing screen, you can go back, put in pause or fast forward a song, control volume, playback of the song, lyricsand more.

    Swipe up on reading to display your queue up next, that lists all the songs that you have selected for the current playback.

    Drag the songs with to rearrange the order, or swipe to the left to remove a song you want to ignore.

    Press on to the right of the next place to mix the songs in a playlist or album.

    Type once to play entire playlist or album looped or twice to repeat a song. Type a third time to remove the repetition.

    Use of music music Apple in the app

    Take care.

  • Why do I may for listening to my own music?

    Hello

    My daughter has an iPad, where she purchased songs in iTunes.

    She wants to listen to these songs also on his phone of Samsung.

    When she tries to download music from Apple app store Google play, she needs to buy a subscription to Apple's music to listen to the songs that she has already bought from iTunes.

    If this is the case, Apple is in charge it twice for the music she wants to hear.

    I hope that we have misunderstood the situation and that Apple can explain how she can listen to the music she bought in iTunes.

    Thank you very much in advance for the advice.

    With sincere friendships.

    William

    Apple music ≠ iTunes! Apple music is apples service - subscription streaming will not get access to the music you already own, but millions of other songs as well.

    What you are looking for is how to get the music purchased from iTunes on your Android phone. This, still once, ha nothing to do with music from Apple. Maybe this web page (and many others like him, just google for it) can help you: https://tunesgo.wondershare.com/android/sync-itunes-music-to-google-play-android .html

    Best,

    MABI

  • I can't listen to my music with using data?

    Then I updated my iphone with its new software and now all the music that I downloaded and played my music with using one of my data and now I can't download from my icloud to listen to using any help my data?

    Hello Shirazsh,

    Thank you for using communities of Apple Support.

    I understand that you are looking for a way to listen to your music not connected to the Wi - Fi that does not use your cellular data. Take a look at this support article: Add music to the music from Apple to your library catalog

    This section describes how to do exactly what you are looking for:

    How to download music to listen to offline

    You can download songs, albums, or playlists on your device so that you can listen to them when you are not connected to the Internet, you need to download tracks, albums or playlists on each device that you want to use for offline listening.

    In the application of the music on your iPhone, iPad or iPod touch, or iTunes on your Mac or PC, find the song, album, or playlist that you want to download. Then:

    • On your iPhone, iPad or iPod touch: tap download .
    • On your Mac or PC: click Download .

    If you do not see or , you need to add songs, albums, or playlists in your library first.

    Best regards.

  • can I listen to music on the watch with a wireless headset while I swim laps?

    can I listen to music on the watch with a wireless headset while I swim laps?

    Short answer, Yes, but you will water proof wireless headsets. Not for the first watch of Gen.

  • Siri is not actually listening...

    Installed at Sierra, impatient to try Siri.  When you are prompted, the window of Siri said... "I'm listening".

    Unfortunately Siri is not really listening. Microphone works but does not Siri.

    Any ideas?

    Same thing here. I tried to use my headset and it works very well with this microphone, just not the microphone internal.

  • How many time you listen to a song to count as "played" (= 1 flow)?

    How many time you listen to a song to count as "played" (= 1 flow)? I know it is 30 seconds for Spotify, is it different for music from Apple?

    Thank you

    Leo

    Until the end of the song.

  • Can not listen using bluetooth headphones with music Apple after updating iOS 10

    I've updated my iPad to iOS 10 Air yesterday. This morning, I plugged my bluetooth headset and tried the Apple music (specifically, the NPR radio station). It sends output to the speakers of the iPad and not the bluetooth headset, and after several attempts does not connect to the bluetooth headset. I checked the bluetooth connection and verified that I could hear Siri through headphones. But Apple music seems not to want to use bluetooth headphones, whatever it is I'm looking for.

    Any suggestions or help would be greatly appreciated.

    Hi the edema,

    It is my understanding that you are experiencing some problems with Apple's music stations on your iPad don't play no not by your Air Bluetooth headset. I listen to music Apple all the time and I know it's nice to be able to listen to the radio stations with headphones. I will do my best to help you.

    As you have noted that you can hear Siri through Bluetooth speakers, you can also try a different like YouTube app to see if you can hear the audio from there through your headphones? In addition, if you do not already made, conclusion of the music app and reopen it and try to play the station again. This happens just this specific station or any station you are listening to?

    Even if you did the following steps part of this article, to get help to connect a Bluetooth accessory with your iPhone, iPad or iPod touch device, there are a couple of additional ones that can help.

    1. Make sure that your device iOS and Bluetooth Accessory are close together.
    2. Make sure your Bluetooth accessory is on and fully charged or connected to power. If it uses batteries, test them to see if they need to be replaced.
    3. Restart your Bluetooth accessory.
    4. Make sure you have the latest version of iOS on your iPhone, iPad or iPod touch.
    5. On your iOS device, go to settings > Bluetooth and make sure Bluetooth is on. If you cannot turn on Bluetooth or you see a spinning gear, restart your iPhone, iPad or iPod touch.
    6. Cancel pairing the Bluetooth accessory, replace the accessory in discovery mode, then the pair and plug it in again.

    Thanks for stopping by Apple Support communities. See you soon.

  • Can I listen to a voice message then save as a new voicemail?

    Can I listen to a voice message then save as a new voicemail?

    I need to be able to listen to a voice message, and then save this as new voice mail as a way to remind me that voicemail requires further action.  Is it possible to do?

    I'm on AT & T with an iPhone 5s.  Latest iOS.

    As to listen to voice messages via the carrier's own analog servers, it cannot be marked as not read times read.

    One idea would be to save them as voice memo, or share, as offered here - How to save voicemails on your iPhone - Apple Support

  • How can I listen to all the songs by an artist (without shuffle)

    Hello

    With the new music app on IOS 10, how as you listen to all songs by an artisit without shuffle?

    I prefer to listen to all the albums from an artist in the order that they were on every album (and then move on the next album, when it's done) but I can't for the life of figure me out how to make it in the new app music.  Play my music like got harder and stronger with each update of the application of music over the years.

    I also have the same question. You used to be able to just tap on the icon of the artist and he started playing all the songs. IOS 10 If you tap the icon, it takes you to the artist's albums and the only thing you can do is shuffle game or chose an album to play.

    Does anyone have a solution to this?

  • Then two sets of the Airpod be used for listening to same iPhone?

    Is it possible to pair two sets of the Airpod to the iPhone same so that two people can share and listen to the sounds, like a watching a movie or a game together?

    Number one at a time.

Maybe you are looking for