How to get the index of the hash map array list,here is my code
ArrayList<HashMap<String, String>> branch_list=new ArrayList<HashMap<String,String>>();
branch_list.clear();
Log.d("kkk", "sew1="+Constants.questions_arr_list+" size="+Constants.questions_arr_list.size());
Cursor cs1 = db.rawQuery("SELECT * from questions WHERE page_sequence='"+onValue+"' and survey_id='"+Constants.survey_id+"' ORDER BY question_sequence ASC",null);
if (cs1.moveToFirst()) {
do {
if (cs1.getString(27).matches("0")) {
HashMap<String, String> map=new HashMap<String, String>();
map.put("id", "" + cs1.getString(0));
map.put("survey_id", "" + cs1.getString(25));
map.put("title", "" + cs1.getString(12));
map.put("type_id", "" + cs1.getString(24));
map.put("required", "" + cs1.getString(7));
map.put("others", cs1.getString(53));
map.put("page_yes", cs1.getString(1));
map.put("page_no", cs1.getString(2));
map.put("page_dontno", ""+cs1.getString(54));
map.put("branching_status", ""+cs1.getString(55));
branch_list.add(map);
Constants.questions_arr_list.add(map);
Constants.questions_arr_list_copy.add(map);
} else {
}
if (cs1.getString(55).matches("1")) {
break;
}
} while (cs1.moveToNext());
} else {
}
Below is my array list after getting values.I want to get index of id=2572, like answer=2.
[{id=2570, title=Page 1 Question 01, others=0, page_yes=0, branching_status=0, page_no=0, required=0, survey_id=592, type_id=1, page_dontno=0}, {id=2571, title=Page 1 Question 02, others=0, page_yes=0, branching_status=0, page_no=0, required=0, survey_id=592, type_id=9, page_dontno=0}, {id=2572, title=Page 1 Question 03 Branching question, others=0, page_yes=2, branching_status=1, page_no=3, required=0, survey_id=592, type_id=8, page_dontno=0}, {id=2575, title=Page 2 Question 01, others=0, page_yes=0, branching_status=0, page_no=0, required=0, survey_id=592, type_id=23, page_dontno=0}, {id=2576, title=Page 2 Question 02 Branching Question, others=0, page_yes=5, branching_status=1, page_no=0, required=0, survey_id=592, type_id=9, page_dontno=0}]
Finally I found a simple solution: