获取的ArrayList< HashMap的<字符串,字符串>>值
问题描述:
在我的第一个活动我的下一个code:
In my first activity I have the next code:
ArrayList<HashMap<String, String>> list_params = new ArrayList<HashMap<String, String>>();
HashMap<String, String> param_aux = new HashMap<String, String>();
param_aux.put("language", Integer.toString(language_spinner.getSelectedItemPosition()));
param_aux.put("city", city_edittext.getText().toString());
list_params.add(param_aux);
和我的第二个活动我想要得到的价值,所以我的code是:
And in my second activity I want to get the values, so my code is:
ArrayList<HashMap<String, String>> list_params_ = new ArrayList<HashMap<String, String>>();
list_params_= (ArrayList<HashMap<String, String>>) getIntent().getSerializableExtra("list_params");
System.out.println("...serialized data.."+list_params_);
如果我再检查一下了System.out中,该值是正确发送,但我想要得到的HashMap中的一个特定值(例如:城市值)
If I chech the System.out, the values are correct sent but I want to get a specific value of the HashMap (example: city value).
...serialized data..[{weekend_midday_check=1, weekend_afternoon_check=0, weekend_morning_check=1, sort_by=0, language=0, weekly_afternoon_check=1, weekly_morning_check=1, weekly_midday_check=1, city=Terrassa}]
我怎样才能获得的价值,为城市中的第一个活动发送?
How can I get the value for the city sent in the first activity?
答
使用:
list_params_.get(0).get("city");