bug in the drop-down list

I want to retrieve a value that I select my drop-down list. When I run my plants of code with the debugger to step to retrieve the index of the selected item. Please help if you are looking for a problem

public class Day extends MainScreen {

    public ObjectChoiceField hourField;
    public  String day[]= {"Monday","Tuesday", "Wednesday", "Thursday", "Friday", "saturday", "sunday"};

    public Day()

    {
        super();
        LabelField title = new LabelField("DAY",
                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);
        add(new RichTextField("Choose the day"));
        add(new SeparatorField());

        ObjectChoiceField listday = new ObjectChoiceField("Days :", day);
        add(listday);

    }

    MenuItem Validate = new MenuItem("Validate", 100, 0) {
        public void run() {

            int i =  listday.getSelectedIndex();
            String str = (String) hourField.getChoice(i);

            UiApplication.getUiApplication().pushScreen(new Show());

            UiApplication.getUiApplication().popScreen(getScreen());

        }
    };

    protected void makeMenu(Menu menu, int instance) {

        menu.add(Validate);

        super.makeMenu(menu, instance);
    }

    public boolean onClose() {
        Dialog.alert("Goodbye!");
        System.exit(0);
        return true;
    }

}

Thank you for all

I solved it I just replaced

ObjectChoiceField listday = new ObjectChoiceField ("days:" day);
Add (listday);

with

listday = new ObjectChoiceField ("days:" day);
Add (listday);

Thank you arkadyz

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • Delete my browsing history to older Firefox?

    Hello I'm just curious to know what is happening with my browsing history in Firefox. I have authorized in March and then has not used the Internet again until mid-April. Since then, I have not allowed once. At present, all of April - June seems to h

  • Satellite C875 - How can I get my serial number of the Windows operating system?

    My C875 Satellite has buggered by a Windows Update and now it does not start. 0xc000014c error code I don't have a copy of the original disc for her but if I know that my Windows serial number I can create a system repair disc. I tried and tried to c

  • Re: Satellite C660-2R3 CPU limitation to 978 Mhz?

    Hi all 5 days ago, I bought a Toshiba Satellite C660 2R3. The laptop has core i5 2.4 GHz and 6 GB of DDR3 memory.However, I am very disappointed by its performance. I run CPU ID/CPU-Z and it turns out that the laptop is limitation up to 978 MHz Core

  • Fastest way to pass the baton on RT PXI-2564?

    I'm trying to pass the baton on a map of relay PXI-2564 on a PXI-8184 LVRT running. I'm running a host vi on my laptop that is networked variable Boolean such as True = False and closed = open. The way I do now the vi devours 64% of my processor PXI

  • Windows 7 on the DV7-7212nr?

    I just purchased a DV7-7212nr two weeks and I tried to give a chance to Windows 8, I don't really have, but I did with her. Is it possible to downgrade to Windows 7 on this computer? I've seen videos on YouTube where they mentioned the "pilots", so I