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 .
Thanks in advance and Sorry for my poor English
My Code is Here
try {
json = new JSONObject(status);
getArray_Meter_Reading = new JSONArray();
getArray_Meter_Reading = json.getJSONArray("meterReadings");
myList = new ArrayList<HashMap<String, String>>();
for (int i = 0; i < getArray_Meter_Reading.length(); i++) {
map = new HashMap<String, String>();
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;
}
});
And my Xml layout which im buinding with this listview
<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" >
<TextView
android:id="@+id/txt_Meter_Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:width="140dp" />
<TextView
android:id="@+id/txt_Previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:width="100dp" />
<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" >
</EditText>
1 Answer