哪位大神告诉我这里的this代指哪个啊import android.app.ListActivity;import android.os.Bundle;import android.widget.ArrayAdapter;public class ex10 extends ListActivity { String[] weekString = new String[]{"星期日","星期一","星期

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 13:41:41
哪位大神告诉我这里的this代指哪个啊importandroid.app.ListActivity;importandroid.os.Bundle;importandroid.widget.Array

哪位大神告诉我这里的this代指哪个啊import android.app.ListActivity;import android.os.Bundle;import android.widget.ArrayAdapter;public class ex10 extends ListActivity { String[] weekString = new String[]{"星期日","星期一","星期
哪位大神告诉我这里的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);
}
}

哪位大神告诉我这里的this代指哪个啊import android.app.ListActivity;import android.os.Bundle;import android.widget.ArrayAdapter;public class ex10 extends ListActivity { String[] weekString = new String[]{"星期日","星期一","星期
因为你定义的ex10类继承自ListActivity基类,而在ex10派生类中并没有实现setListAdapter方法,所以在这里this应该是指ListActivity基类的实例