Gosn的使用

来源:互联网 发布:微软办公软件2007 编辑:程序博客网 时间:2024/05/18 18:00
String jsonLists;try {jsonLists = new JSONObject(response).get("chglist").toString();Type listType = new TypeToken<List<ChatMsgBean>>() {}.getType();final List<ChatMsgBean> datas = new Gson().fromJson(jsonLists,listType);
</pre><pre name="code" class="html">为什么编辑器里不提示  new TypeToken的方法?




格式化时间,后边格式随便定义SimpleDateFormat df = new SimpleDateFormat("HH:mm"); String dateTime = df.format(t.getTime()*1000L);  


0 0
原创粉丝点击