title: Storing or maintaining ListView EditText values into ArrayList<String>
body: <p>My question is :- <strong>I want to store all EditText values of ListView into ArrayList</strong>.
  <br>In my App I have <code>Custom ListView</code> with row as <code>EditText</code>. Just consider <code>listview</code> have 20 rows.<br> when i m doing this task I <strong>Firstly</strong> faced Scrolling Issue of <code>ListView</code>(that means values of <code>EditText</code> are messed.(places somewhere else)), But Luckly solved it.<br>
  Now I want to store that all values into <code>ArrayList&lt;String&gt;</code>.<br> Yes I also written code for that into my adapter.But <strong>Getting Exception NullPointer</strong> when setting that list to outside use.<br>Also I never want to set that ArrayList inside getView(causes problem when view recycling)<br> I known that Exception becoz of <code>TextWatcher Listener</code>. then what should be alternative for that.Also I never have any button for saving data.Just want to store as values appears into EditText's of ListView one by one.<br>
  Here is my Adapter Class :- <br></p>
  
  <pre><code>public class MyAdapter extends ArrayAdapter&lt;String&gt; 
  {
      private LayoutInflater mInflater;       
       public ArrayList&lt;String&gt; _values;
       ArrayList&lt;String&gt; data;
       Model model;
      public MyAdapter(Context context,int res,ArrayList&lt;String&gt; obj) {
          super(context,res,obj);
          mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);             
          _values=new ArrayList&lt;String&gt;();
          model=new Model();
          this.data=obj;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          final ViewHolder holder;
  
          if (convertView == null) {
              convertView = mInflater.inflate(R.layout.listview, null);
              holder = new ViewHolder();               
              holder.caption = (EditText) convertView.findViewById(R.id.editText1);              
             holder.tv=(TextView)convertView.findViewById(R.id.textView1);
             holder.tv.setText(data.get(position));
          } else {
              holder = (ViewHolder) convertView.getTag();
              holder.tv.setText(data.get(position));
          }
  
          holder.caption.addTextChangedListener(new TextWatcher()
          {
              public void afterTextChanged(Editable edt) 
              {
                  _values.add(edt.toString());
              }
  
              public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {}
  
              public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { }
          });
  
          convertView.setTag(holder);
          holder.ref=position;
          holder.caption.setText(_values.get(position));
          model.setData(_values);//here getting exception
          return convertView;
      }
  }
  
  class ViewHolder {
      EditText caption;   
      TextView tv;
      int ref;
  }
  </code></pre>
  
  <p>This is Model Class I m using for Outside Purpose about that String<br></p>
  
  <pre><code> public class Model 
   {
     ArrayList&lt;String&gt; data;
  
     public ArrayList&lt;String&gt; getData() {
         return data;
     }
     public void setData(ArrayList&lt;String&gt; data) {
      this.data = data;
      for(String str : data)
          Log.v("data=", str);
     }
  }
  </code></pre>