private void rebuildList(Bundle savedInstanceState) { String[] itemArray = getResources().getStringArray(R.array.items); ArrayList<String> items = new ArrayList<String>(Arrays.asList(itemArray)); adapter = new MyArrayAdapter(savedInstanceState, this, items); adapter.setOnItemClickListener(this); adapter.setAdapterView(getListView()); }
@Override protected void onSaveInstanceState(Bundle outState) { adapter.save(outState); }
public void onItemClick( android.widget.AdapterView<?> adapterView, View view, int position, long id) { Toast.makeText(this, "Item click: " + adapter.getItem(position), Toast.LENGTH_SHORT).show(); }
private void selectAll() { for (int i = 0; i < adapter.getCount(); ++i) { adapter.select(i); } }
private void selectAll() { for (int i = 0; i < adapter.getCount(); ++i) { adapter.setItemChecked(i, true); } }