2011-08-11 55 views
-1

当我运行此代码时,我不断收到IllegalArgumentException并且没有在BlackBerry模拟器上显示。它有什么问题?需要现场经理帮助黑莓

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_RIGHT); 

     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); 

    } 
+3

第1步是找出哪里IllegalArgumentException抛出。做一些调试来弄清楚,然后用你的发现来更新这个问题。 –

回答

0

的抛出:IllegalArgumentException可能是不相关的,但没有被显示到你的屏幕上,因为你没有添加任何东西到你的屏幕。

您需要将vfield添加到屏幕本身。添加以下行:

add(vfield); 
+0

感谢您的回复。我尝试了你的建议,但我不断收到消息,指出找不到源文件,我应该打开调试透视窗口。不知道什么是错的。很抱歉打扰,但是对于Blackberry Deevelopment来说,这是相当新颖的。 – irobotxxx

+0

我想你应该尝试另一个模拟器,或者在启动之前(JDE中的文件菜单)擦除模拟器上的数据。你需要摆脱任何其他应用程序抛出该异常。在您尝试执行正确的开发时,在您无法访问的代码中获取异常并不是一个好的情况。此外,进入调试菜单并取消选中任何说你应该进入调试模式的愚蠢的东西,如内存分配。 –

+0

好吧,会尝试,让你知道它是如何去。 – irobotxxx