加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

遍历JSONObject

发布时间:2020-12-16 19:11:09 所属栏目:百科 来源:网络整理
导读:public void initialFilter(JsonNode filter) {// 智能数据来源smartDataList = new ArrayListString();String smart = filter.get("order_by").toString();try {JSONObject obj = new JSONObject(smart);IteratorString keys = obj.keys();while (keys.hasN
public void initialFilter(JsonNode filter) {
	// 智能数据来源
	smartDataList = new ArrayList<String>();
	String smart = filter.get("order_by").toString();
	try {
		JSONObject obj = new JSONObject(smart);
		Iterator<String> keys = obj.keys();
		while (keys.hasNext()) {
                // 这是把所有的key添加到list了
			smartDataList.add(keys.next());
		}
			
	} catch (JSONException e) {
		e.printStackTrace();
	}
		
	ArrayAdapter<String> smartAdapter = new ArrayAdapter<String>(mActivity,android.R.layout.simple_list_item_1,smartDataList);
	smartView = LayoutInflater.from(mActivity).inflate(R.layout.store_filter_smart,null);
	smartListView = (ListView) smartView.findViewById(R.id.lv_shop_smart);
	smartListView.setAdapter(smartAdapter);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读