title: How to retrieve values from dialog ListView...?
body: <p>I'm showing a list using dialog...the list contains <code>Text View</code> and <code>Edit Text</code> widgets and a (Done)<code>Button</code>.</p>
  
  <p>Clicking on (Done)<code>Button</code> will retrieve those rows from the list which contain values in <code>Edit Text</code>.</p>
  
  <p>The problem is if rows goes out of the view when scrolling. I'm not getting those rows when the <code>Button</code> is clicked.</p>
  
  <pre><code>doneButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          AddedItems = new ArrayList&lt;productinfo&gt;();
          try {
              for(int i = 0;i&lt;allProducts.size();i++) {   
                  View view = productListView.getChildAt(i);
                  TextView product = (TextView) view.findViewById(R.id.product_textview);
                  String pName = product.getText().toString();
                  TextView p_code = (TextView)  view.findViewById(R.id.product_code);
                  String pCode = p_code.getText().toString();
                  TextView p_price = (TextView) view.findViewById(R.id.price_textview);
                  String pPrice = p_price.getText().toString();
                  EditText qty = (EditText) view.findViewById(R.id.quantity_edittext);
                  String qtyVal = qty.getText().toString();
  
                  if(qty.getText().toString().matches("")) {
                      //do nothing
                  } else {
                      AddedItems.add(new productinfo(pCode, pName, "", pPrice, "",qtyVal));
                      addedProduct.removeAllViews();
                  }
              }
  </code></pre>
  
  <p>And this is the adapter:</p>
  
  <pre><code>private List&lt;productinfo&gt; products;
      private List&lt;productinfo&gt; arrayList;
      private Context context;
      private String[] tmp;
      private int value;
  
      public ProductListAdapter(Context context, int resource,ArrayList&lt;productinfo&gt; products) {
          // TODO Auto-generated constructor stub
          super(context, resource, products);
          this.context=context;
          this.products=products;
          this.arrayList = new ArrayList&lt;productinfo&gt;();
          this.arrayList.addAll(products);
          tmp = new String[products.size()];
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return products.size();
      }
  
      @Override
      public productinfo getItem(int position) {
          // TODO Auto-generated method stub
          return products.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public int getItemViewType(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
  
      @Override
      public int getViewTypeCount() {
          // TODO Auto-generated method stub
          return products.size();
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          final ViewHoldr holder;
  
          if(convertView == null){
  
              holder = new ViewHoldr();
  
              LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = inflater.inflate(R.layout.product_list_row_layout, null);
  
              holder.productCode = (TextView) convertView.findViewById(R.id.product_code);
              holder.productDescription = (TextView) convertView.findViewById(R.id.product_textview);
              holder.productPrice = (TextView) convertView.findViewById(R.id.price_textview);
              holder.quantity = (EditText) convertView.findViewById(R.id.quantity_edittext);
  
              convertView.setTag(holder);
          }
          else
          {
              holder = (ViewHoldr) convertView.getTag();          
          }
  
          holder.ref = position;
  
          final productinfo product = products.get(position);
  
           //int colorPos = position % colors.length;
             // convertView.setBackgroundColor(colors[colorPos]);
  
          if(product !=null){
  
  
              if(holder.productCode!=null)
                  holder.productCode.setText(product.getP_CODE());
  
              if(holder.productDescription!=null)
                  holder.productDescription.setText(product.getP_NAME());
  
              if(holder.productPrice!=null)
                  holder.productPrice.setText(product.getMRP());
  
              //holder.quantity.setText(product.getP_qty());
  
              holder.quantity.setText(tmp[position]);
  
              holder.quantity.addTextChangedListener(new TextWatcher() {
  
                  @Override
                  public void onTextChanged(CharSequence s, int start, int before, int count) {
                      // TODO Auto-generated method stub
  
                  }
  
                  @Override
                  public void beforeTextChanged(CharSequence s, int start, int count,
                          int after) {
                      // TODO Auto-generated method stub
  
                  }
  
                  @Override
                  public void afterTextChanged(Editable s) {
                      // TODO Auto-generated method stub
                      tmp[holder.ref] = s.toString(); 
                  }
              });
  
  
                 //check for odd or even to set alternate colors to the row background
                 if(position % 2 == 0){  
                  convertView.setBackgroundColor(Color.parseColor("#6897bb"));
                 }
                 else {
                  convertView.setBackgroundColor(Color.parseColor("#cbd3db"));
                 }
          }
  
          return convertView;
      }
  
      private class ViewHoldr
      {
          TextView productCode;
          TextView productDescription;
          TextView productPrice;
          EditText quantity;
          int ref;
      }
  </code></pre>
  
  <p>This is the layout for row:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:weightSum="10"
      &gt;
  
         &lt;TextView
          android:id="@+id/product_code"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="2.5"
          android:gravity="top|left"
          android:textColor="#ffffff"
          /&gt;
  
      &lt;TextView
          android:id="@+id/product_textview"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="4.3"
          android:text="jshadb"
          android:textColor="#ffffff" /&gt;
  
      &lt;TextView
          android:id="@+id/price_textview"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight="1.2"
          android:text="464.89"
          android:textColor="#ffffff" /&gt;
  
      &lt;EditText 
          android:id="@+id/quantity_edittext"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="2"
          android:inputType="number"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And this is the layout used in my activity to display rows:</p>
  
  <pre><code>&lt;LinearLayout 
          android:id="@+id/addedProduct"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/header_layout"
          android:orientation="vertical"
          android:layout_marginTop="2dp"
          android:layout_marginBottom="2dp"
          android:showDividers="middle"
          android:divider="@drawable/vertical_divider" 
          android:dividerPadding="5dp"      
          &gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And this is for dialog:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
   &gt;
       &lt;ListView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_below="@id/header_layout"
              android:layout_above="@id/done_button"
              android:id="@+id/product_listview"
               /&gt;
  
  
      &lt;Button
              android:layout_width="match_parent"
              android:layout_height="35dp"
              android:text="Done"
              android:layout_alignParentBottom="true"
              android:id="@+id/done_button" /&gt;
  &lt;RelativeLayout /&gt;
  </code></pre>