我正在开发的天气应用程序有问题。构造函数应该创建一个列表,但是当应用程序运行时,它只显示一个空白屏幕。
ERROR:
';' expected
no suitable constructor found for List(javax.microedition.lcdui.List)
constructor javax.microedition.lcdui.List.List(java.lang.String,int,java.lang.String[],javax.microedition.lcdui.Image[]) is not applicable
(actual and formal argument lists differ in length)
constructor javax.microedition.lcdui.List.List(java.lang.String,int) is not applicable
(actual and formal argument lists differ in length)
//带有构造函数的类
public class WeatherMIDlet extends BaseMIDlet implements CommandListener {
private List list3;
private List getWeatherLocationView(List list3) {
if (weatherConditionSearch == null) {
weatherConditionSearch = new WeatherConditionSearch(this, list3);
}
return weatherConditionSearch; //list should dislay here!
}
//我想创建本地引用列表的类
public class WeatherConditionSearch extends List implements CommandListener {
private Command okCmd, backCmd;
private TextField locationTfld;
private BaseMIDlet midlet;
private List list;
public WeatherConditionSearch(BaseMIDlet midlet, List list3) //super class is List
{
super(list3);//error is at this line
this.midlet = midlet;
lists();
addCommand(okCmd);
addCommand(backCmd);
setCommandListener(this);
}
private void lists() {
okCmd = new Command("Get", Command.OK, 0);
backCmd = new Command("Back", Command.BACK, 1);
if (list == null) {
list = new List("Cities", Choice.IMPLICIT);
list.append("Kampala", null);
list.append("Entebbe", null);
list.append("Mubende", null);
list.setCommandListener(this);
list.setSelectedFlags(new boolean[]{false, false, false});
}