> 其他 >
哪位大神告诉我这里的this代指哪个啊
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class ex10 extends ListActivity {
String[] weekString = new String[]{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
ArrayAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
adapter = new ArrayAdapter(this ,android.R.layout.simple_list_item_1,weekString);
this.setListAdapter(adapter);
}
}
人气:140 ℃ 时间:2020-06-24 11:50:18
解答
因为你定义的ex10类继承自ListActivity基类,而在ex10派生类中并没有实现setListAdapter方法,所以在这里this应该是指ListActivity基类的实例
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版