return mEmptyView;
super.onCreate(savedInstanceState); mAdapter = new CarefulAdapter<String>(this, android.R.layout.simple_list_item_1); setContentView(R.layout.list_with_empty_view); setListAdapter(mAdapter); mEmptyView = findViewById(R.id.empty); getListView().setEmptyView(mEmptyView);
super.onCreateOptionsMenu(menu); menu.add(0, MENU_ADD, 0, R.string.menu_add) .setIcon(android.R.drawable.ic_menu_add); menu.add(0, MENU_REMOVE, 0, R.string.menu_remove) .setIcon(android.R.drawable.ic_menu_delete); return true;
switch (item.getItemId()) { case MENU_ADD: String str = "Item + " + mNextItem++; mAdapter.add(str); return true; case MENU_REMOVE: if (mAdapter.getCount() > 0) { mAdapter.remove(mAdapter.getItem(0)); } return true; } return super.onOptionsItemSelected(item);