开发者

need help with Field Managers Blackberry

I keep getting an IllegalArgumentException and nothing shows on the BlackBerry simulator when I run this code. What could be wrong with it?

 public MyScreen()
    {        
        // Set the displayed title of the screen and add the weather icons      
        setTitle("PixWeather");

        cityField = new LabelField("Queensland", Field.FIELD_LEFT);
        tempField = new LabelField("17", Field.FIELD_RIGHT);

        condField = new LabelField("sunny",Field.FIELD_RI开发者_JAVA技巧GHT);

       weather_icon = Bitmap.getBitmapResource("sun_icon.png");
        bitmapField = new BitmapField(weather_icon, Field.FIELD_LEFT);

        VerticalFieldManager vfield = new VerticalFieldManager();


        HorizontalFieldManager hfield1 = new HorizontalFieldManager();
        hfield1.add(cityField);
        hfield1.add(tempField);

        HorizontalFieldManager hfield2 = new HorizontalFieldManager();
        hfield2.add(bitmapField);
        hfield2.add(condField);

        vfield.add(hfield1);
        vfield.add(hfield2);

    }


The IllegalArgumentException could be unrelated, but nothing is showing up on your screen because you didn't add anything to your screen.

You need to add the vfield to the screen itself. Add the following line:

add(vfield);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜