title: Move item between two listviews when user clicks on item makes the app stop
body: <p>I'm trying move an item between two list views (one contains the checked items and the other the nonchecked items). So when an item is clicked its checked state has changed so it is moved to the other listview. But it is not working. </p>
  
  <p>Java code:</p>
  
  <pre><code>public class T_C_Activity extends Activity {
      /**
       * Called when the activity is first created.
       */
  
      //private EditText edittext;
      private Button button;
      private  ArrayAdapter&lt;String&gt; adapter;
      private  ArrayAdapter&lt;String&gt; adapter1;
  
      private boolean[] check = new boolean[10];
  
      String[] countries = new String[]{
              "India",
              "Pakistan",
              "Sri Lanka",
              "China",
              "Bangladesh",
              "Nepal",
              "Afghanistan",
              "North Korea",
              "South Korea",
              "Japan"
      };
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          ListView lvc = (ListView) findViewById(R.id.lvc);
  
          ListView lvnc = (ListView) findViewById(R.id.lvnc);
  
          adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_multiple_choice, countries);
          //lvnc.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
          lvnc.setAdapter(adapter); lvnc.setAdapter(adapter);
  
          adapter1 = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_multiple_choice, new String[0]);
  
                  lvc.setAdapter(adapter1);
  
          lvnc.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
                  //To change body of implemented methods use File | Settings | File Templates.
                  String s = adapter.getItem(i);
                  adapter1.add(s);
                  adapter.remove(s);
                  adapter1.notifyDataSetChanged();
                  adapter.notifyDataSetChanged();
              }
          });
  
          lvc.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
                  //To change body of implemented methods use File | Settings | File Templates.
                  String s = adapter.getItem(i);
                  adapter.add(s);
                  adapter1.remove(s);
                  adapter.notifyDataSetChanged();
                  adapter1.notifyDataSetChanged();
              }
          });
  
      }
  }
  </code></pre>
  
  <p>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:layout_width="fill_parent"
                android:layout_height="fill_parent"
          &gt;
  
  &lt;ListView
          android:id="@+id/lvc"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:choiceMode="multipleChoice"
          /&gt;
  
      &lt;ListView
              android:id="@+id/lvnc"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:choiceMode="multipleChoice"
              /&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the crash output:</p>
  
  <pre><code>11-01 04:39:15.478: ERROR/AndroidRuntime(613): FATAL EXCEPTION: main
          java.lang.UnsupportedOperationException
          at java.util.AbstractList.add(AbstractList.java:404)
          at java.util.AbstractList.add(AbstractList.java:425)
          at android.widget.ArrayAdapter.add(ArrayAdapter.java:179)
          at com.app.T_C_Activity$1.onItemClick(T_C_Activity.java:56)
          at android.widget.AdapterView.performItemClick(AdapterView.java:298)
          at android.widget.AbsListView.performItemClick(AbsListView.java:1086)
          at android.widget.AbsListView$PerformClick.run(AbsListView.java:2859)
          at android.widget.AbsListView$1.run(AbsListView.java:3533)
          at android.os.Handler.handleCallback(Handler.java:615)
          at android.os.Handler.dispatchMessage(Handler.java:92)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:4745)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:511)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>When an Item in the lvnc (ListView) is clicked the app stops. What is wrong? Also, I do not see a separation between the two listviews. Thanks.</p>