2017 android network request, android network request data processing (handled in the adapter)

Network request:

in onRespend

EntityCatogory response

The usage of the response object is not introduced

save:

msg.obj = response new thread

EntityCatogory obj = (EntityCatogory)msg.obj;

TBCategory databased = new TBCategory();

databased.key = ... (keyy) ..;

databased.content= JGson.instance().gson().toJson(response);!!!!!! Don't deconstruct and make string directly pass

databased.createAt = System.currentTimeMillis();

Cache is used:

TbCategory databaseCache = DbHelper.queryCategoryCacheByKey (keyy);

if (databaseCache != null && databaseCache.content != null && !DateUtils.isExpire(databaseCache.createdAt)) {

brandData = GsonUtils.parseJsonWithGson(databaseCache.content, EntityCatogory.class);

}

brandData object usage is not introduced

Original text: http://www.cnblogs.com/vitabebeauty/p/7263078.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324135916&siteId=291194637