这是导致错误的代码。抱歉,我的原始帖子发生了很大变化,但我现在已将所有代码放在一个地方。告诉我这是不是一个糟糕的主意。
我在为我的 ListView 设置 myArrayAdapter 的行上出现错误
public class DisplayCaf extends Activity implements OnNavigationListener {
private static final String STATE_SELECTED_NAVIGATION_ITEM = null;
//Holds items.
ArrayList<String> menuArray;
//String adapter for ListView
ArrayAdapter<String> myArrayAdapter;
//set listView
ListView listView;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pager_caf);
listView = (ListView)findViewById(R.id.listView);
menuArray = new ArrayList<String>();
//set up the adapter for listView
myArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menuArray);
//connect adapter to feed info to listView
listView.setAdapter(myArrayAdapter);
}
}