Search code examples
androidlistadapterandroid-tablelayoutsimpleadapter

How to edit EditText view inside SimpleAdapter


I am working on simpleAdapter which is showing database list in table layout. I am successfully able to show this list in table layout. But now I want to edit EditText of this simple adapter. My table layout of simple adapter contains Checkbox, TextView and EditText. Right now I am not able edit EditText e1 inside this simple adapter. I want to set text inside this edittext e1 and set some value based of formula which is using previous edittext e1 which I am editing. This value should be set in another edittext e2 which is in the same row. My code for simpleadapter is as follows :

            ListAdapter adapter1 = new SimpleAdapter(
                    getActivity(), contactList2,
                    R.layout.table_list_item, new String[]{
                    TAG_PRODUCT, "WMS",TAG_PRODUCTPERCARTON, TAG_UNITPRICE,TAG_PRODUCTPERCARTON2,TAG_UNITPRICE,cartonnumber,"No. of Products","Discount",TAG_TotalPrice,"Add","Check"}, new int[]{R.id.txtcustomerName, R.id.mycheck,R.id.txtorderamount, R.id.txtorderstatus,R.id.txtorderdate,R.id.txtorderby,R.id.txtordercarton,R.id.txtproduct,R.id.txtdiscount,R.id.txtprice,R.id.txtadd,R.id.mynewcheck});
            setListAdapter(adapter1);

Solution

  • I solved this issue by using listview.setOnItemClickListener and using android:focusable="false" inside xml file for edittext and checkbox.