title: Passing selected items from ListView to another Activity
body: <p>MainActivity is my class where the user selects the items off the list view. I use the setOnItemClickListener to get the selected items , from this point I dont know how to pass it to the next activity , do i need to use the parcellable interface ? or is there another way just through intents.</p>
  
  <p>public class MainActivity extends AppCompatActivity implements Parcelable {</p>
  
  <pre><code>ArrayList&lt;String&gt; shoppingList;
  ArrayAdapter adapter;
  ListView lv;
  </code></pre>
  
  <p>ArrayList  selected ;</p>
  
  <pre><code>protected MainActivity(Parcel in) {
  
  }
  
  public static final Creator&lt;MainActivity&gt; CREATOR = new Creator&lt;MainActivity&gt;() {
      @Override
      public MainActivity createFromParcel(Parcel in) {
          return new MainActivity(in);
      }
  
      @Override
      public MainActivity[] newArray(int size) {
          return new MainActivity[size];
      }
  };
  
  @Override
  public int describeContents() {
      return 0;
  }
  
  @Override
  public void writeToParcel(Parcel dest, int flags) {
      dest.writeStringList(shoppingList);
  }
  
  @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      // Example of a call to a native method
  
      shoppingList = new ArrayList&lt;&gt;();
      Collections.addAll(shoppingList, "Eggs", "Yogurt", "Milk", "Bananas", "Apples", "Tide with bleach", "Cascade","candy","Dental Floss","Toothpaste");
      shoppingList.addAll(Arrays.asList("ice cream","hand lotion"));
  
  
      adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, shoppingList);
  
      lv = (ListView) findViewById(R.id.listview);
      lv.setAdapter(adapter);
      lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int Position, long id) {
              Toast.makeText(MainActivity.this, " You Selected  "+((TextView) view).getText() , Toast.LENGTH_SHORT).show();
              selected = new ArrayList();
              Collections.addAll(selected,((TextView) view).getText());
  
               System.out.println(((TextView) view).getText());
          }
      });
  
  }
  
  public void checkout(View view){
      Intent intent = new Intent(this,SelectedItemsControl.class);
  
      startActivity(intent);
  }
  </code></pre>