Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to do validation in Android EditText within a ListView?
    text
    copied!<p>i have one List in which their are two textview and one EditView in single row . I bind these textviews and editview at runtime and now i want to do some validation for edittext inside listview ,but my EditView ID is same for all the Rows, so how can i apply validations in that editview plz help me .</p> <p>Thanks in advance and Sorry for my poor English</p> <p>My Code is Here </p> <pre><code>try { json = new JSONObject(status); getArray_Meter_Reading = new JSONArray(); getArray_Meter_Reading = json.getJSONArray("meterReadings"); myList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); for (int i = 0; i &lt; getArray_Meter_Reading.length(); i++) { map = new HashMap&lt;String, String&gt;(); String meter_Name = getArray_Meter_Reading.getJSONObject(i) .getString("MeterName").toString(); String previous_Meter_Reading = getArray_Meter_Reading .getJSONObject(i).getString("PrevMeterReading") .toString(); map.put("meterName", meter_Name); map.put("previousMeterReading", previous_Meter_Reading); myList.add(map); } } catch (JSONException e) { e.printStackTrace(); } SimpleAdapter myAdapter = new SimpleAdapter(this, myList, R.layout.meter_reading_list, new String[] { "meterName", "previousMeterReading" }, new int[] { R.id.txt_Meter_Name, R.id.txt_Previous}); lst.setAdapter(myAdapter); lst.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_MOVE){ lst.scrollBy(0, 1); } return false; } }); </code></pre> <p>And my Xml layout which im buinding with this listview </p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingBottom="6dip" android:paddingTop="4dip" &gt; &lt;TextView android:id="@+id/txt_Meter_Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:width="140dp" /&gt; &lt;TextView android:id="@+id/txt_Previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:width="100dp" /&gt; &lt;EditText android:id="@+id/ed_Current" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:imeOptions="actionNext|actionDone" android:singleLine="true" android:width="100dp" &gt; &lt;/EditText&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload