在Android app Development for Dummies 中,我在最后一段代码后出现错误。
该类型的方法
setListAdapter(ArrayAdapter<String>)
未定义ReminderListActivity
代码如下:
package com.dummies.android.taskreminder;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class ReminderListActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.reminder_list);
String[] items = new String[] { "Foo", "Bar", "Fizz", "Bin"};
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items);
setListAdapter(adapter);
}
}