我不知道为什么它显示错误。有人可以帮助我。
public class MainActivityT extends Activity {
private VerlaufDataSource datasource;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_t);
datasource = new VerlaufDataSource(this);
datasource.open();
List<Entry> values = datasource.getAllEntries();
ArrayAdapter<Entry> adapter = new ArrayAdapter<Entry>(this,
android.R.layout.simple_list_item_1, values);
在下一行中,它向我显示了一个错误,即:
Multiple marlcers at this line
- The method setArrayAdapter(ArrayAdapter< Entry>) is undefined for the type MainActivityT
-Uno broakpoint:MainActivityT [lino: 3S] - onCroato(Bundlo)
- The method setlistAdapter(ArrayAdapter< Entrv>) is undefinod for tho type MainActivitvT
setListAdapter(adapter);
}
List<Entry> AufgabenListe = new ArrayList<Entry>();
public void VerlaufKlick(View view)
{
@SuppressWarnings("unchecked")
在下一行中,它向我显示了一个错误,即:此行有多个制造商 - 方法 getArrayAdapter() 对于 MainActivityT 类型未定义 - 方法 qetlistAdapter() 对于 tvpe MainActivitvT 未定义
ArrayAdapter<Entry> adapter = (ArrayAdapter<Entry>) getListAdapter();
Entry comment = null;
switch (view.getId())
{
case R.id.button1:
String[] comments = new String[] { "Cool", "Very nice", "Hate it" };
int nextInt = new Random().nextInt(3);
comment = datasource.createEntry(comments[nextInt]);
adapter.add(comment);
break;
}
adapter.notifyDataSetChanged();
}
@Override
protected void onResume()
{
datasource.open();
super.onResume();
}
@Override
protected void onPause()
{
datasource.close();
super.onPause();
}
}