how to get value from edittext which is placed into custom listview
<p>i have a custom listview and for every row their is one Edit text and one Button.
I just want to get value of edit text when we click on that button.</p>

<p><a href="https://i.stack.imgur.com/Jp40V.png" rel="nofollow">click here for activity image</a></p>

<p>as shown in image i want to get value of edittext which is for quantity when we click on add to cart Button.
For that i used Adapter and code was like below:</p>

<pre><code>public class ProductList_Adapter extends ArrayAdapter {

Context context;
int resource;
List&lt;ProductList_ModelClass&gt; productList_modelClasses = new ArrayList&lt;&gt;();

TextView tv_product_title;
TextView tv_product_price;
ImageView img_productImage;
RatingBar rb_custom_productlist;
EditText et_productQty;
Button btn_addto_Cart;
String product_Qty;

public ProductList_Adapter(Context context, int resource, List objects) {
    super(context, resource, objects);

    this.context = context;
    this.resource = resource;
    this.productList_modelClasses = objects;
}

@Override
public int getCount() {
    return this.productList_modelClasses.size();
}

@NonNull
@Override
public View getView(final int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
        LayoutInflater layoutInflater = ((Activity) context).getLayoutInflater();
        convertView = layoutInflater.inflate(resource, parent, false);
    }

    img_productImage = (ImageView) convertView.findViewById(R.id.img_productImage);
    tv_product_title = (TextView) convertView.findViewById(R.id.tv_product_title);
    tv_product_price = (TextView) convertView.findViewById(R.id.tv_product_price);
    rb_custom_productlist = (RatingBar) convertView.findViewById(R.id.rb_custom_productlist);
    et_productQty = (EditText) convertView.findViewById(R.id.et_productQty);
    btn_addto_Cart = (Button) convertView.findViewById(R.id.btn_addto_Cart);


    Picasso.with(context)
            .load(productList_modelClasses.get(position).getProduct_image())
            .resize(250, 250)
            .placeholder(R.mipmap.icon_placeholder)   // optional
            .error(R.mipmap.icon_error)      // optional
            .into(img_productImage);

    tv_product_title.setText(productList_modelClasses.get(position).getProduct_name());
    rb_custom_productlist.setRating(productList_modelClasses.get(position).getProduct_rating());
    tv_product_price.setText("₹ " + productList_modelClasses.get(position).getProduct_price());


    product_Qty = et_productQty.getText().toString();

    btn_addto_Cart.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Toast.makeText(context, product_Qty + , Toast.LENGTH_SHORT).show();
        }
    });

    convertView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(context, productList_modelClasses.get(position).getProduct_name(), Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(context, ProductActivity.class);
            intent.putExtra("product_id", productList_modelClasses.get(position).getProduct_id());
            context.startActivity(intent);


        }
    });

    return convertView;
}
}
</code></pre>