获取ArrayList<HashMap<String,String>>价值观 [英] Get ArrayList<HashMap<String, String>> values

查看:23
本文介绍了获取ArrayList<HashMap<String,String>>价值观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的第一个活动中,我有下一个代码:

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);

在我的第二个活动中,我想获取值,所以我的代码是:

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");

这篇关于获取ArrayList&lt;HashMap&lt;String,String&gt;&gt;价值观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆