java - Intent putExtra position of ArrayList -
i have arraylist of hashmaps trying put in intent detail listview. have retrieved arraylist in listview, stuck on getting correct position arraylist.
// declarations jsonarray comments_data = null; arraylist<hashmap<string, string>> comments_list; // storing values (int z=0; z < comments_data.length(); z++) { jsonobject cd = (jsonobject)comments_data.get(z); string commenttext = cd.getstring("text"); string username = cd.getjsonobject("from").getstring("username"); hashmap<string, string> comments_hash = new hashmap<string, string>(); comments_hash.put("text", commenttext); comments_hash.put("from.username", username); comments_list.add(comments_hash); } public void onitemclick(adapterview<?> parent, view view, int pos, long id) { intent = new intent(); i.putextra("comments_list", comments_list); // here having issue. have tried comments_list.get(pos), crashes. current 1 stores of values instead of getting values associated item clicked. startactivity(i); }
Comments
Post a Comment