title: Update ListAdapter Dynamically During execution
body: <p>I am trying to change the ListView data mid-program by using a button at the top that switches between negative and positive lists.</p>
  
  <pre><code>private ArrayList&lt;LifeTask&gt; positiveListData = new ArrayList&lt;LifeTask&gt;();
  private ArrayList&lt;LifeTask&gt; negativeListData = new ArrayList&lt;LifeTask&gt;();
  private ArrayList&lt;LifeTask&gt; currentListData = positiveListData;
  private ListAdapter adapter;
  private ListView gameList;
  </code></pre>
  
  <p>By default I have <code>currentListData</code> pointing to the positive list.  In the <code>onCreate()</code> function of the app I have the following code:</p>
  
  <pre><code>adapter = new ListAdapter(this, R.layout.list_item, currentListData);
  gameList = (ListView) findViewById(R.id.main_list_view);
  gameList.setAdapter(adapter);
  </code></pre>
  
  <p>When the negative button is pressed I try doing the following:</p>
  
  <pre><code>currentListData = negativeListData;
  adapter.notifyDataSetChanged();
  </code></pre>
  
  <p>but nothing changes.  What am i doing wrong?</p>
  
  <p>EDIT: Adapter code added as per requested</p>
  
  <pre><code>package cs.ucsb.cs185.dimberman.lifeRPG;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  public class ListAdapter extends ArrayAdapter&lt;LifeTask&gt;{
      Context context; 
      int layoutResourceId;    
      ArrayList&lt;LifeTask&gt; data = null;
  
      public ListAdapter(Context context, int layoutResourceId, ArrayList&lt;LifeTask&gt; List_Data) {
          super(context, layoutResourceId, List_Data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = List_Data;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          ItemHolder holder = null;
          if(row == null)
          {
              LayoutInflater inflater = ((Activity)context).getLayoutInflater();
              row = inflater.inflate(layoutResourceId, parent, false);
              holder = new ItemHolder();
              holder.name = (TextView)row.findViewById(R.id.ItemName);
              row.setTag(holder);
          }
          else
          {
              holder = (ItemHolder)row.getTag();
          }
  
          LifeTask s = data.get(position);
          holder.name.setText(s.getName());
          return row;
  
      }
  
      static class ItemHolder{
  
          TextView name;
  
      }
  }
  </code></pre>