title: Create a new list from selected items from a listview
body: <p>This Question has been modified to show working code.</p>
  
  <p>When they click an item such as Steak, I want that item to be placed into another list.  If they then select Potatoes, that too should be added to this new list such that at the end I would have a list that shows all the items the user selected. Here is what I have so far.</p>
  
  <p>LunchListMenu.java</p>
  
  <pre><code>package com.mycompany.lunch;
  
  import java.util.ArrayList;
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.ListView;
  import android.widget.Toast;
  
  public class LunchListMenu extends Activity {  
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(final Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.maincoarse);
          final ListView lv=(ListView)findViewById(R.id.listView1);              
          ArrayAdapter&lt;CharSequence&gt; adapter=ArrayAdapter.createFromResource(this, R.array.lunch_menu,android.R.layout.simple_list_item_1);
          lv.setAdapter(adapter);
          final ArrayList&lt;String&gt; myNewList = new ArrayList&lt;String&gt;();
          lv.setOnItemClickListener(new OnItemClickListener() {
  
  
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {  
                  String item=lv.getItemAtPosition(arg2).toString();
                  String itemordered;
                  itemordered = item + " added to list";
                  Toast.makeText(getApplicationContext(), itemordered, Toast.LENGTH_SHORT).show();
                  myNewList.add(item);                
              }
          });
  
                  // List View Button
                  Button btnLunchList = (Button) findViewById(R.id.lrList);
                  btnLunchList.setOnClickListener(new View.OnClickListener() {
  
                      @Override
                      public void onClick(View v) {                       
                          setContentView(R.layout.selecteditems);
                          ListView selecteditems = (ListView) findViewById(android.R.id.list);
                          ArrayAdapter&lt;String&gt; newadapter = new ArrayAdapter&lt;String&gt;(LunchListMenu.this, android.R.layout.simple_list_item_1, myNewList);              
                          selecteditems.setAdapter(newadapter);
                      }
                  });
      }
                      public void shareMyList(View v){
                          // Share Selected Items Button
                          Button btnShareItems = (Button) findViewById(R.id.shareMyList);
                          btnShareItems.setOnClickListener(new View.OnClickListener() {
  
                              @Override
                              public void onClick(View v) {
                                  // TODO Auto-generated method stub
  
                                  Intent share = new Intent(Intent.ACTION_SEND);
                                  share.setType("text/plain");
                                  share.putExtra(Intent.EXTRA_TEXT, "I'm being sent!!");
                                  startActivity(Intent.createChooser(share, "Share Text"));
                              }
  
  
                          });
                      }
  }
  </code></pre>
  
  <p>I also created a New Layout called selecteditems.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:background="@drawable/main_background" 
    android:paddingLeft="10.0dip" 
    android:paddingTop="0.0dip" 
    android:paddingRight="10.0dip" 
    android:paddingBottom="10.0dip" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"&gt;
  
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="100.0dip"
              android:background="@drawable/title" /&gt;
  
          &lt;LinearLayout 
              android:orientation="horizontal" 
              android:background="@drawable/head" 
              android:layout_width="fill_parent" 
              android:layout_height="10.0dip" /&gt;    
  
            &lt;ListView 
                android:id="@android:id/list"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="25dip"
                android:textStyle="bold"
                android:padding="10dip"
                android:textColor="#ffffff"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>It now adds the Item to the new selecteditems.</p>