I tried out lot my ways to update hashMap value on specific position but i am not able to do. I have a custom Array List in which i stored hash map array list for specific position array list. And in my list view adapter i am creating dynamic linear layout on the basis of count of hashmap array list, in that linear layout i have a edit Text also.
Now on click of edit text of each item of linear layout. i have to update the hash map value for that particular position and for particular value.
My Adapter code is like this:-
for (j = 0; j < arry_tickt_info.get(position).getArray_ticket_data().size(); j++) {
// Create LinearLayout
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams qntityParams = new LinearLayout.LayoutParams(0,60, 1f);
// Create Quantitiy EditText
final EditText edQntity = new EditText(context);
final ArrayList<HashMap<String, String>> hashMaps = arry_tickt_info.get(j).getArray_ticket_data();
edQntity.setText(arry_tickt_info.get(position).getArray_ticket_data().get(j).get("quantity"));
edQntity.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
final int position = v.getId();
for (Map.Entry<String, String> e1 : hashMaps.get(Integer.parseInt(txtHiddenId.getText().toString())).entrySet()) {
String s = e1.getValue();
String s1 = e1.getKey();
if (e1.getKey().equalsIgnoreCase("quantity")) {
String roundedOff = edQntity.getText().toString();
e1.setValue(String.valueOf(roundedOff));
Log.e("updatedValue::::", "updatedValue::::" + roundedOff);
}
}
}
}
});
edQntity.setGravity(Gravity.CENTER_HORIZONTAL);
edQntity.setEms(2);
edQntity.setHeight(60);
edQntity.setBackgroundResource(R.drawable.edittext_grey_outline);
edQntity.setTextColor(Color.parseColor("#555555"));
edQntity.setLayoutParams(qntityParams);
ll.addView(edQntity);
}