它在标记“;”上写入语法错误 ,, 预计行后private ArrayAdapter adapter ;
package ru.for_listactivity;
import android.os.Bundle;
import android.app.ListActivity;
import android.view.Menu;
import android.widget.ArrayAdapter;
public class MainActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(adapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
final String[] catnames = new String[] { "Рыжик", "Барсик", "Мурзик",
"Мурка", "Васьк", "Томасина", "Бобик", "Кристина", "Пушок",
"Дымка", "Кузя", "Китти", "Барбос", "Масяня", "Симба" } ;
private ArrayAdapter<String> adapter ; // here is a problem
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, catnames);
}