Error translation: Expected to return an object but returned an array
.Use TypeToken to turn it around:
//设置参数
Gson gson = new Gson();
List<TotalDataEntry> totalDataList = new ArrayList<>();
String pic_history = sp.getString("home_hourOffLine", "");
if (!TextUtils.isEmpty(pic_history)) {
//存入json串 将json字符串转换成List集合
Type listType = new TypeToken<List<TotalDataEntry>>() {
}.getType();
totalDataList = gson.fromJson(pic_history, listType);
}