@Override public void analyze(BaseActivity baseActivity) { String json = Mysharedperferences.getIinstance().getString(baseActivity, key); try { JSONArray jsonArray = new JSONArray(json); JSONObject jsonObject = jsonArray.optJSONObject(0); JSONArray jsonList = jsonObject.optJSONArray("list"); for (int i = 0; i < jsonList.length(); i++) { JSONObject jsonObject1 = jsonList.optJSONObject(i); FunctionEntity functionEntity = new FunctionEntity(jsonObject1.toString()); data.add(functionEntity); } } catch (JSONException e) { e.printStackTrace(); } }
@Override public void clearSaveData(BaseActivity baseActivity) { Mysharedperferences.getIinstance().putString(baseActivity, key, ""); data.clear(); }
@Override public void saveData(BaseActivity baseActivity, String json) { Mysharedperferences.getIinstance().putString(baseActivity, key, json); analyze(baseActivity); }