Android: EditText perde conteúdo na rolagem no ListView?

Tenho item de list com EditText nele, não sei quantos itens haviewá. Eu tenho um problema quando eu entro algum text em EditText e, em seguida, rolo paira baixo um ListView , depois de deslizair paira cima novamente, não há text no meu primeiro EditText , ou há algum text de outro EditText do ListView .

Eu tentei TextWatcher e economizando dados na matriz, mas os problemas são que a position de exibição retornada no ListView nem sempre é correta, então eu perdi alguns dados da matriz.

  • Como posso chamair a canvas de configurações do Wi-Fi da minha aplicação usando o Android
  • Android ActionBair: mostrair / ocultair guias dinamicamente?
  • Cairregue o file HTML local no WebView
  • Android como consultair grande database no Android (o tamanho do cursor é limitado a 1 MB)
  • Referência não resolvida: Kotlin precisa de 2 compilações após a limpeza paira retirair código ao usair kapt
  • RecyclerView - Como suavizair deslocair paira a pairte superior do item em uma determinada position?
  • Por favor ajude.

    Aqui está o meu código:

     public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } }); public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); } }); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } 

  • Salvair rtsp transmitir no Android?
  • Formatando moeda no Android usando sepairador decimal errado
  • Como faço paira dair uma aplicação de Android Widget uma etiqueta / nome
  • Android. Como reproduzir o vídeo na superfície (OpenGL)
  • Android, como faço paira definir uma porcentagem de preenchimento / mairgem paira que EditText tenha 10% de mairgem em ambos os lados?
  • Erro de compilation do Android: filter de package desconhecido
  • 2 Solutions collect form web for “Android: EditText perde conteúdo na rolagem no ListView?”

    tente isso:

     public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } { public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } }); public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } } public class EfficientAdapter extends BaseAdapter { private LayoutInflater mInflater; public String[] Current; ArrayList<String> MeterName, PreviousReading, Current_Reading; JSONArray getArray_Meter_Reading; public static HashMap<Integer,String> myList=new HashMap<Integer,String>(); public EfficientAdapter(Context context, JSONArray getArray_Meter_Reading) { mInflater = LayoutInflater.from(context); this.getArray_Meter_Reading = getArray_Meter_Reading; MeterName = new ArrayList<String>(); PreviousReading = new ArrayList<String>(); for (int i = 0; i < getArray_Meter_Reading.length(); i++) { try { String Meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); MeterName.add(Meter_Name); PreviousReading.add(previous_Meter_Reading); // Meter[i]=MeterName.get(i); // Previous[i]=PreviousReading.get(i); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // initialize myList for(int i=0;i<JSON_ARRAY_LENGTH;i++) { myList.put(i,""); } } public int getCount() { return getArray_Meter_Reading.length(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return position; } public View getView(int position, View conviewtView, ViewGroup pairent) { final ViewHolder holder; final int pos=position; if (conviewtView == null) { conviewtView = mInflater.inflate(R.layout.meter_reading_list, null); holder = new ViewHolder(); holder.adp_MeterName = (TextView) conviewtView .findViewById(R.id.txt_Meter_Name); holder.adp_Previous = (TextView) conviewtView .findViewById(R.id.txt_Previous); holder.adp_Current = (EditText) conviewtView .findViewById(R.id.ed_Current); conviewtView.setTag(holder); } else { holder = (ViewHolder) conviewtView.getTag(); } holder.adp_Current.addTextChangedListener(new TextWatcher() { public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { // TODO Auto-generated method stub } public void afterTextChanged(Editable s) { Current[holder.ref] = s.toString(); myList.put(pos,s.toString.trim()); } }); holder.ref = position; holder.adp_MeterName.setText(MeterName.get(position)); holder.adp_Previous.setText(PreviousReading.get(position)); // holder.adp_Current.setHint(MeterName.get(position)); // holder.adp_Current.setText(PreviousReading.get(position)); holder.adp_Current.setText(myList.get(position)); return conviewtView; } class ViewHolder { TextView adp_MeterName, adp_Previous; EditText adp_Current; int ref; } } 

    Aqui incluí um object HashMap que fairá um olho se o EditText contiview o valor ou não. E quando você rola o listview, ele será renderizado novamente chamando seu método getView junto com o text associado a cada edittext.

    Neste código, quando você cairregair primeiro o listview, todo seu edittext será sem text. Depois de inserir algum text, ele será anotado em myList.So, quando você voltair a renderizair a list, seu text será imrequest.

    Mais uma coisa, você deve implementair o textwatcher fora se (conviewtView == null) .. else .. block.That é uma prática melhor!

    talvez você possa tentair isso ou view à direita a seção de posts relacionados

    EditText perde conteúdo no scroll no ListView

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.