Read EditText Content From ListView
<p>I have a ListView in following manner</p>

<pre><code>Item_name       Quantity      Price/Unit    Net Amount

&lt;TextView&gt;     &lt;EditText&gt;    &lt;TextView&gt;    &lt;TextView&gt;
&lt;TextView&gt;     &lt;EditText&gt;    &lt;TextView&gt;    &lt;TextView&gt;
&lt;TextView&gt;     &lt;EditText&gt;    &lt;TextView&gt;    &lt;TextView&gt;
&lt;TextView&gt;     &lt;EditText&gt;    &lt;TextView&gt;    &lt;TextView&gt;
</code></pre>

<p>and so on</p>

<p>Now i want that when i enter any text in the EditText for quantity then it should generate the Net Amount by given formaula</p>

<p>Net Amount=Quantity*Price/Unit</p>

<p>Example</p>

<p>Quantity     3
Price/Unti   30</p>

<p>so Net Amount TextView should display 90</p>

<p>I want this in an efficient user interface way</p>

<p>Please give me any solution</p>

<p>My code</p>

<pre><code>Class FinalOrder.java

import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import com.DAL.MenuCumActivity;

public class FinalOrder extends MenuCumActivity
{
    private static String[] items=null;
    private static String[] price=null;
    private static String[] netamount=null;
    private ListView listview;
    public void onCreate(Bundle b)
    {
        super.onCreate(b);
        setContentView(R.layout.finalorderview);
        items=getIntent().getStringArrayExtra("items");
        price=getIntent().getStringArrayExtra("price");
        netamount=new String[price.length];
        listview=(ListView)findViewById(R.id.listview);
        EfficientAdapter adapter=new EfficientAdapter(this);
        listview.setAdapter(adapter);
        listview.setOnItemClickListener(new OnItemClickListener()
        {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; parentView, View v, int position,long id) 
            {
                Toast.makeText(v.getContext(),"select",Toast.LENGTH_LONG).show();
            }
        });
    }
    public void onFocus(View v)
    {
        listview.setFocusable(true);
        //listview.
    }
    private static class EfficientAdapter extends BaseAdapter 
    {
         private LayoutInflater mInflater;
         private Context ctx;
         public EfficientAdapter(Context context)
         {
             ctx=context;
             mInflater = LayoutInflater.from(context);
         }

         public int getCount() 
         {
             return items.length;
         }
         public Object getItem(int position) 
         {
             return position;
         }
         public long getItemId(int position) 
         {
             return position;
         }
         public View getView(int position, View convertView, ViewGroup parent) 
         {
            ViewHolder holder;
            if (convertView == null) 
            {
                 convertView = mInflater.inflate(R.layout.finalorderitem,parent,false);
                 holder = new ViewHolder();
                 holder.item = (TextView) convertView.findViewById(R.id.txtnameFinalOrderItem);
                 holder.quantity=(EditText)convertView.findViewById(R.id.edttextFinalOrderQty);


                 holder.singleprice = (TextView) convertView.findViewById(R.id.txtperpriceFinalOrderItem);
                 holder.finalprice=(TextView)convertView.findViewById(R.id.txtfinalpriceFinalOrderItem);
                 holder.item.setText(items[position]);
                 holder.singleprice.setText(price[position]);
                 int net_amount=0;
                 if(!holder.quantity.getText().toString().equals(""))
                     net_amount=Integer.parseInt(holder.quantity.getText().toString())*Integer.parseInt(price[position]);
                 holder.finalprice.setText(""+net_amount);
                 convertView.setTag(holder);
            }
            else
            {
                holder = (ViewHolder) convertView.getTag();
            }
            holder.item.setText(items[position]);
            holder.singleprice.setText(price[position]);
            holder.quantity.setText("");
            int net_amount=0;
            if(!holder.quantity.getText().toString().equals(""))
                net_amount=Integer.parseInt(holder.quantity.getText().toString())*Integer.parseInt(price[position]);
            holder.finalprice.setText(""+net_amount);
            return convertView;
         }
         public class ViewHolder 
         {
             TextView item;
             EditText quantity;
             TextView singleprice;
             TextView finalprice;

         }
    }
}
</code></pre>

<p>My Layout Files</p>

<p><strong>finalorderview.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout android:id="@+id/main"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"&gt;
    &lt;!-- Header --&gt;
    &lt;LinearLayout android:id="@+id/header"
        android:background="#FFFFFF"
        android:padding="10dip"
        android:orientation="horizontal"
        android:paddingBottom="5dip"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        &gt;
        &lt;TextView android:id="@+id/heading"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:text="Select Quantity"
            android:gravity="left"
            android:layout_weight="1"
            android:textColor="#CC6633"
            android:textSize="25px"
            android:textStyle="bold"
        /&gt;
        &lt;Button
            android:text="Make Order"
            android:id="@+id/btnOrder"
            android:layout_weight="1"
            android:textSize="15px"
            android:gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"&gt;
        &lt;/Button&gt;
    &lt;/LinearLayout&gt;
    &lt;LinearLayout android:id="@+id/header"
        android:background="#FFFFFF"
        android:padding="5dip"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        &gt;
        &lt;LinearLayout 
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_gravity="center"
            android:padding="5dip"
            android:id="@+id/linearLayout2"&gt;
            &lt;TextView
                android:id="@+id/txtnameItem"
                android:text="Item"
                android:gravity="center"
                android:textColor="#000000"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"&gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;
        &lt;LinearLayout 
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:layout_weight="1"
            android:padding="5dip"
            android:gravity="left"
            android:id="@+id/linearLayout2"&gt;
            &lt;TextView
                android:id="@+id/txtquantityfinalorder"
                android:text="Quantity"
                android:layout_weight="1"
                android:textColor="#000000"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"&gt;
            &lt;/TextView&gt;
            &lt;TextView
                android:id="@+id/txtperprice"
                android:gravity="center"
                android:text="Price"
                android:layout_weight="1"
                android:textColor="#000000"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:layout_gravity="left"&gt;
            &lt;/TextView&gt;
            &lt;TextView
                android:id="@+id/txtfinalprice"
                android:gravity="right"
                android:text="Net Amount"
                android:layout_weight="1"
                android:textColor="#000000"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"&gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;
    &lt;/LinearLayout&gt;
    &lt;!-- List Divider --&gt;
    &lt;View android:layout_width="fill_parent"
        android:layout_height="5dip"
        android:background="#C85A17" /&gt;
    &lt;!-- ListView (list_items) --&gt;
    &lt;LinearLayout android:id="@+id/layout"
        android:layout_width="fill_parent"
        android:orientation="vertical"
        android:layout_height="wrap_content"&gt;
        &lt;ListView android:id="@+id/listview"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:descendantFocusability="beforeDescendants"
            android:layout_width="fill_parent"&gt;
        &lt;/ListView&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p><strong>2) finalorderitem.xml</strong></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="fill_parent"
  android:orientation="vertical"
  android:background="#FFFFFF"
  android:layout_height="fill_parent"&gt;
    &lt;LinearLayout
        android:layout_margin="15dip"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:background="#FFFFFF"
        android:orientation="horizontal"
        android:id="@+id/linearLayout1"&gt;
        &lt;LinearLayout 
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_gravity="center"
            android:padding="3dip"
            android:paddingRight="0dip"
            android:id="@+id/linearLayout2"&gt;
            &lt;TextView
                android:id="@+id/txtnameFinalOrderItem"
                android:textSize="20px"
                android:textStyle="bold"
                android:text="col_1"
                android:gravity="left"
                android:textColor="#000000"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"&gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;
        &lt;LinearLayout 
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_weight="1"
            android:textStyle="bold"
            android:id="@+id/linearLayout2"&gt;
            &lt;EditText
                android:text="0"
                android:id="@+id/edttextFinalOrderQty"
                android:layout_width="fill_parent"
                android:layout_weight="1"
                android:numeric="integer"
                android:layout_height="wrap_content"&gt;
            &lt;/EditText&gt;
            &lt;TextView
                android:id="@+id/txtperpriceFinalOrderItem"
                android:gravity="center"
                android:layout_gravity="center"
                android:text="price"
                android:layout_weight="1"
                android:textSize="15px"
                android:textColor="#000000"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"&gt;
            &lt;/TextView&gt;
            &lt;TextView
                android:id="@+id/txtfinalpriceFinalOrderItem"
                android:gravity="right"
                android:layout_gravity="center"
                android:text="col_2"
                android:layout_weight="1"
                android:textSize="20px"
                android:textStyle="bold"
                android:textColor="#000000"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"&gt;
            &lt;/TextView&gt;
        &lt;/LinearLayout&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>
