use of com.androidwind.androidquick.demo.bean.GankFuliBean in project AndroidQuick by ddnosh.
the class JsonFragment method onClick.
@OnClick({ R.id.btn_tools_gsonhelper_common, R.id.btn_tools_gsonhelper_generic, R.id.btn_tools_fastjsonhelper })
public void onClick(View view) {
mTvConsole.setText("");
switch(view.getId()) {
case R.id.btn_tools_gsonhelper_common:
long startTime1 = System.nanoTime();
GankFuliBean gsonObj = GsonUtil.fromJson(testJsonString, GankFuliBean.class);
List<GankFuliBean.FuliBean> fulis = gsonObj.getResults();
String desc = " ";
for (GankFuliBean.FuliBean fuli : fulis) {
desc += fuli.getDesc() + "\n";
}
ToastUtil.showToast(desc);
mTvConsole.setText(gsonObj.toString());
break;
case R.id.btn_tools_gsonhelper_generic:
long startTime2 = System.nanoTime();
GankRes<List<FuliBean>> gsonObj2 = GsonUtil.fromJson(testJsonString, new TypeToken<GankRes<List<FuliBean>>>() {
});
long consumingTime2 = System.nanoTime() - startTime2;
ToastUtil.showToast("耗时" + consumingTime2 / 1000 + "微秒");
break;
case R.id.btn_tools_fastjsonhelper:
long startTime3 = System.nanoTime();
GankRes<List<FuliBean>> fastObj = FastJsonHelper.parseObject(testJsonString, new TypeReference<GankRes<List<FuliBean>>>() {
});
long consumingTime3 = System.nanoTime() - startTime3;
ToastUtil.showToast("耗时" + consumingTime3 / 1000 + "微秒");
break;
}
}
Aggregations