listview - Not able to enter and edit values in edit text android list view -


am new list view in android , want enter different values manually in edit text in list view but able achieve , body guide me achieve it

package com.example.limitscale.beautylog;  import java.util.arraylist; import java.util.hashmap; import java.util.locale; import android.app.activity; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.graphics.color; import android.text.editable; import android.text.textwatcher; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.button; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.edittext; import android.widget.imagebutton; import android.widget.imageview; import android.widget.linearlayout; import android.widget.textview; import android.widget.toast;  public class giftadapter extends baseadapter {  // declare variables context context; layoutinflater inflater; arraylist<hashmap<string, string>> data; imageloader imageloader; checkbox check; //boolean[] checkboxstate; private int editingposition = 0; viewholder viewholder; edittext quantity1; int temp; int q=0; public static final string prefs_name = "myappsharedprefs"; hashmap<string, string> resultp = new hashmap<string, string>();  public giftadapter(context context,                        arraylist<hashmap<string, string>> arraylist) {     this.context = context;     //  checkboxstate=new boolean[arraylist.size()];     data = arraylist;     imageloader = new imageloader(context); } private class viewholder {     checkbox check;     edittext quantity1; } @override public int getcount() {     return data.size(); }  @override public object getitem(int position) {     return null; }  @override public long getitemid(int position) {     return 0; }   public view getview(final int position, view convertview, viewgroup parent) {     viewholder holder = null;     temp=position;     inflater = (layoutinflater) context             .getsystemservice(context.layout_inflater_service);     view itemview = inflater.inflate(r.layout.giftadapter, parent, false);      viewholder=new viewholder();      resultp = data.get(position);      final textview country = (textview) itemview.findviewbyid(r.id.product);     final  textview population = (textview) itemview.findviewbyid(r.id.price);     quantity1 = (edittext) itemview.findviewbyid(r.id.quantity);     quantity1.addtextchangedlistener(new textwatcher() {          @override         public void aftertextchanged(editable arg0) {             // todo auto-generated method stub             string chartext = quantity1.gettext().tostring().tolowercase(locale.getdefault());              chartext = chartext.tolowercase(locale.getdefault());          }          @override         public void beforetextchanged(charsequence arg0, int arg1,                                       int arg2, int arg3) {             // todo auto-generated method stub         }          @override         public void ontextchanged(charsequence arg0, int arg1, int arg2,                                   int arg3) {             // todo auto-generated method stub         }     });      final  imageview flag = (imageview) itemview.findviewbyid(r.id.image);     final linearlayout content = (linearlayout) itemview.findviewbyid(r.id.content);     imagebutton add_ = (imagebutton) itemview.findviewbyid(r.id.ad_01);      final string quan = quantity1.gettext().tostring();     country.settext(resultp.get(giftafriend.country));     population.settext(resultp.get(giftafriend.population));     imageloader.displayimage(resultp.get(giftafriend.flag), flag);      add_.setonclicklistener(new onclicklistener() {         @override         public void onclick(view v) {             content.setbackgroundcolor(0xffedd3f6);              resultp = data.get(position);             sharedpreferences settings = context.getsharedpreferences(prefs_name, context.mode_private);             sharedpreferences.editor editor = settings.edit();             editor.putstring("addservice", resultp.get(giftafriend.country));             editor.putstring("addprice", resultp.get(giftafriend.population));             editor.commit();             ((mainactivity) context).showadd1((resultp.get(position)));          }     });      return itemview; }} 

enter image description here

i want output edit text not allowing me change values in it. displaying value 0 hint have given in xml.

gift adapter.xml

<?xml version="1.0" encoding="utf-8"?>  <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="80dp" android:orientation="horizontal" android:descendantfocusability="blocksdescendants" android:checkmark="?android:attr/listchoiceindicatormultiple" android:id="@+id/listrow">  <imageview     android:layout_width="80dp"     android:layout_height="80dp"     android:scaletype="fitxy"     android:id="@+id/image" />  <linearlayout     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:orientation="horizontal"     android:id="@+id/content">      <linearlayout         android:layout_weight="1"         android:layout_width="wrap_content"         android:layout_height="80dp"         android:orientation="vertical">         <textview             android:layout_width="match_parent"             android:layout_height="40dp"             android:id="@+id/product"             android:textstyle="bold"             android:textsize="16dp"             android:paddingleft="10dp"             android:paddingtop="10dp"             android:hint="title"             />          <linearlayout             android:layout_width="wrap_content"             android:layout_height="40dp"             android:orientation="horizontal">             <textview                 android:layout_width="match_parent"                 android:layout_height="40dp"                 android:textsize="16dp"                 android:paddingtop="10dp"                 android:text="rs"                 android:layout_marginleft="12dp"                 />             <textview                 android:layout_width="match_parent"                 android:layout_height="40dp"                 android:id="@+id/price"                 android:textsize="16dp"                 android:layout_marginleft="2dp"                 android:paddingleft="4dp"                 android:paddingtop="10dp"                 android:hint="price"                 />         </linearlayout>     </linearlayout>     <linearlayout         android:layout_width="wrap_content"         android:layout_height="fill_parent"         android:orientation="horizontal">           <edittext             android:layout_weight="1"             android:id="@+id/quantity"             android:layout_width="50dp"             android:gravity="center"             android:hint="0"             android:textcolor="@color/blue"             android:textcolorhint="@color/blue"             android:layout_marginright="4dp"             android:layout_margintop="25dp"             android:textsize="16dp"             android:background="@drawable/boxborder"             android:layout_height="30dp" />          <imagebutton             android:id="@+id/ad_01"             android:layout_weight="1"             android:layout_width="40dp"             android:layout_height="40dp"             android:textsize="20dip"             android:layout_marginright="8dp"             android:text="+"             android:layout_margintop="20dp"             android:textcolor="#000000"             android:background="@drawable/cart"/>     </linearlayout> </linearlayout> 

try removing android:descendantfocusability="blocksdescendants" adapter item layout.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -