2013年8月26日星期一

Android2.2 JSON problem

Lane project uses json yesterday , it was found a very egg pain problems , android2.2 comes org.json.JSONArray did not actually remove method . So the Internet contains a org.json package , running up and run to remove it encounters an exception , checked the Internet is a packet collisions . Since I have not changed , changed json-lib, results and error , checked the Internet actually said google does not support json-lib, do not know is not true . So decided to rewrite JSONArray, estimate the level is not enough, re- finish or a variety of issues .
Will you next time you use android2.2 development is how to deal json, comes with egg package does not remove too much pain .
------ Solution ---------------------------------------- ----
not how used, but rarely now 2.2 mobile phones in use ..
------ Solution -------------- ------------------------------
try FastJson
------ Solution --- -----------------------------------------
school learning , attention in the ~ ~
------ Solution --------------------------------------- -----
with Google jar package, parsing JSON class import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
Type listType = new TypeToken > () {}. getType ();
Gson gson = new Gson ();
LinkedList users = gson.fromJson (json, listType);
------ reference -------------- -------------------------
company's project is 2.2 , no way
------ reference --- ------------------------------------
Thank you for your answer , FastJson not tried , Available to study under , Gson not what I want function , and finally themselves , the method is to set down org.json source , another package name does not conflict

没有评论:

发表评论