json笔记
来源:互联网 发布:memached 端口信息 编辑:程序博客网 时间:2024/06/08 00:35
BQRequestBuilder reqBuilder = new BQRequestBuilder(); reqBuilder.put("version", remoteVersion); HttpLogicLayer.getInstance().showCityList(reqBuilder, new BiquJsonHttpResponseHandlerEx<HttpResponseBase>(HttpResponseBase.class) { @Override public void onBQSuccess(int statusCode, final HttpResponseBase response) { String data = null; try { } catch (Exception e) { e.printStackTrace(); } data = response.getDesc(); if (data == null) { return; } JsonParser parser = new JsonParser(); JsonObject json = null; try { json = parser.parse(data).getAsJsonObject(); } catch (Exception ex) { Crashlytics.setString("value", remoteVersion); Crashlytics.log(data); throw ex; } String verson = null; if (json.has("version")) { verson = json.get("version").getAsString(); } if (json.has("citys")) { JsonArray arr = json.get("citys").getAsJsonArray(); Gson gson = new Gson(); //new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); List<CityBean> inList = gson.fromJson(arr.get(0).getAsJsonObject().get("国内"), new TypeToken<List<CityBean>>() { }.getType()); List<CityBean> outList = gson.fromJson(arr.get(0).getAsJsonObject().get("国际"), new TypeToken<List<CityBean>>() { }.getType()); cityBeanList.setVersion(verson); LocalDataManager.getInstance().getConfigStorage().setStringProperty("city_version", verson); cityBeanList.setInCitys(inList); cityBeanList.setOutCitys(outList); //保存数据库// DBManager.getInstance().getCityListDao().updateCityList(cityBeanList); //重新排序 initSortedCityListIn(); initSortedCityListOut(); } } @Override public void onBQFailure(int statusCode, HttpResponseBase errorResponse) { } });
0 0
- json笔记
- Json笔记
- Json笔记
- json笔记
- json笔记
- JSON 笔记
- JSON笔记
- json笔记
- json笔记
- Json 笔记
- JSON笔记
- Json笔记
- Json笔记
- json笔记
- Json笔记
- JSON笔记
- Json(Json.Net)学习笔记
- JSON学习笔记
- httpClient对post内容gzip压缩和server端解压接收
- 非整行截断
- bananapi之开发板介绍
- 为什么要重写了equals方法后一定要重写hashcode方法
- 商业智能在公安交通管理领域的应用
- json笔记
- 【C++11新特性】 C++11智能指针之weak_ptr
- 根据iPhone6进行适配
- armv7 armvs7 arm64
- bag of feature
- 模式识别相似性测度距离计算---夹角余弦和特征二值得夹角余弦
- /Z7、/Zi、/ZI(调试信息)
- tomcat添加SSL端口
- [leetcode]1. Two Sum