use of com.lingtuan.firefly.vo.UserInfoVo in project SmartMesh_Android by SmartMeshFoundation.
the class JsonUtil method readLocalInfo.
/**
* Read local information
*/
public static ArrayList<UserInfoVo> readLocalInfo(Context mContext) {
String localInfo = MySharedPrefs.readString(mContext, MySharedPrefs.FILE_USER, MySharedPrefs.KEY_LOCAL_USERINFO);
ArrayList<String> localidList = new ArrayList<>();
ArrayList<UserInfoVo> localInfoList = new ArrayList<>();
try {
JSONArray array = new JSONArray(localInfo);
if (array.length() > 0) {
for (int i = 0; i < array.length(); i++) {
localidList.add(array.optString(i));
}
}
for (int j = 0; j < localidList.size(); j++) {
String jsonString = MySharedPrefs.readString(mContext, MySharedPrefs.FILE_USER, localidList.get(j));
JSONObject jsonObject = new JSONObject(jsonString);
UserInfoVo infoVo = new UserInfoVo().parse(jsonObject.optJSONObject(localidList.get(j)));
localInfoList.add(infoVo);
}
} catch (JSONException e) {
e.printStackTrace();
}
return localInfoList;
}
Aggregations