Bundle类是一个key-value对,类似于Map,
在Activity之间传值时,需要遍历Bundle,其中有个函数keySet()是返回所有Key的,利用此函数对bundle进行遍历
- Intent intent = this.getIntent();
- Bundle bundle = intent.getExtras();
- Set<String> keySet = bundle.keySet(); //获取所有的Key,
- for(String key : keySet){ //bundle.get(key);来获取对应的value
- //自己的业务需要
- HashMap<String,Object> querymap = new HashMap<String,Object>();
- String[] str = new String[2];
- str[0] = myTools.findIndexOf(key, "date")[0];
- String str2 = myTools.findIndexOf(key, "date")[1];
- str2 = str2.substring(0, str2.length()-4);
- querymap.put("phonenum", str[0]);
- querymap.put("date", str2);
- querylist.add(querymap);
- }
转载地址:http://blog.csdn.net/whackw/article/details/43085821