I have an Array of strings in a ListView that is set to take multiple choices with "Done" being checked when the user is done. I'd like to create a new Activity using an Intent
String[] names = new String[] {"Ham","Cheese","Lettuce", "Bacon", "Done"};
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice,
android.R.id.text1, names));
ListView listView = getListView();
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
What I am trying to do below is based on the information that is checked by the user I want to put certain information into the new listview and then show them the listview once they click "Done" by startActivity. I'm not sure if this is the correct way to go about this.
Intent e = new Intent(getApplicationContext(), FormedList.class);
if(listView.getCheckItemIds().toString().equals("Ham"))
e.putExtra("Meat", selectedChildren);
if(listView.getCheckItemIds().toString().equals("Cheese"))
e.putExtra("Dairy", selectedChildren);
if(listView.getCheckItemIds().toString().equals("Bacon"))
e.putExtra("Swine", selectedChildren);
if(listView.getCheckItemIds().toString().equals("Done"))
startActivity(e);