×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Red face Unit Picker Component

    I'm building an app to Nokia 501 using the Nokia SDK 1.0

    I want to add a unit picker to my interface, using a FormItem, like in this example
    http://developer.nokia.com/Resources...nitpicker.html

    But I don't need more than one unit to set the data. If I set one data only in the unit's vector the component returns me an error

    Uncaught exception: java.lang.NullPointerException
    - com.nokia.lwuit.components.PickerItemContainer.updateLabelColorsOnDrag(PickerItemContainer.java:210)
    - com.nokia.lwuit.components.PickerItemContainer.initLabels(PickerItemContainer.java:171)
    - com.nokia.lwuit.components.PickerItemContainer.setSelectedIndex(PickerItemContainer.java:247)
    - com.nokia.lwuit.components.PickerItemContainer.<init>(PickerItemContainer.java:87)
    - com.nokia.lwuit.components.UnitPicker.<init>(UnitPicker.java:108)

    If I set two values in the vector, there is no problem, bu I don't need it.

    I anyone has an example of how customize UnitPicker in a simple way. It will be great!

    Code:
    Vector unitWeightVector = new Vector();
                unitWeightVector.addElement("g");
    
                atualPicker = new UnitPicker("Peso atual", "Peso", unitWeightVector);
                atualPicker.setUnitPickerListener(new UnitPickerListener() {
                    public void notifyUnitPickerListener(UnitPicker up) {
                        atualItem.setItemValueText(atualPicker.getValue());
                        formRegister.show();
                    }
                });
    
    
                atualItem = new FormItem("Peso atual:", atualPicker.getValue(), false);
                atualItem.setFormItemListener(new FormItemListener() {
                    public void notifyFormItemListener(FormItem fi, Component cmpnt, boolean bln) {
                        Display.getInstance().setForceFullScreen(false);
                        atualPicker.show();
                    }
                });

  2. #2
    Registered User
    Join Date
    Dec 2013
    Posts
    1

    Re: Unit Picker Component

    I have the exact same problem, I need only one unit in my unit picker too but it won't work that way.
    At the "new UnitPicker(arg0, arg1, arg2)" call I get a nullPointerException if I try it with arg2 as a Vector with one element.

    Interestingly, above the previous exception if I run it on a Nokia Asha 501 phone then the first "new UnitPicker(arg0, arg1, arg2)" call fails no matter how many elements arg2 has, it throws an "ArrayIndexOutOfBoundsException". Subsequent calls succeed though.

    I guess UnitPicker is a bit buggy? Anyway I'm also interested in UnitPicker customization or some other fix.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: Unit Picker Component

    though I don't know that new class UnitPicker or haven't looked into its code there is one question that's begged to be asked,
    why do you need a Unit Picker if you only have 1 VALUE, that's not much of a user free pick is it? seems like a bad UX to offer a user 1 option and say "pick"
    Heard of DVLUP? Join here

  4. #4
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Unit Picker Component

    I only need one unit value, but the component is cool for choosing the value of the field, I mean the numbers.

    Finally I don't use that component in my UI, I finally use the Slider Component, but It doesn't works as the S40 Slider Component. It has so many bugs setting the max, min and progress....It's the only thing that I can do :-(

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Unit Picker Component

    i would recommend if you have only one unit why not to draw a list view only , with that one unit. I think you can control the styling better in a listview !!

Similar Threads

  1. How to use date picker in s40?
    By Manpreet_Singh in forum Mobile Java UI and User Experience
    Replies: 17
    Last Post: 2013-06-12, 05:33
  2. Date Picker Dialog
    By AdnanShoukat in forum [Archived] Qt Quick
    Replies: 13
    Last Post: 2012-06-01, 07:16
  3. Photo gallery picker possible ?
    By lxbach in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2011-02-02, 17:46
  4. DateTime Picker in MIDP
    By bapithanc in forum Mobile Java General
    Replies: 2
    Last Post: 2008-08-09, 05:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •