我可以知道为什么会发生这样的错误吗?
谷歌.JsonSyntaxException: java.哎呀。EOFException:结束 第 3782 行第 1 列的输入
private void initView() {
String js = loadJSONFromAsset(getActivity(), "brandtypes.json");
Gson g = new Gson();
BrandccokersHub p = g.fromJson(js, Brandcookers.class);
List<BrandCountryList> ctry = p.getCountryList();
List<BrandTypeBrandList> ctrycook = new ArrayList<>();
for (int i = 0; i < ctry.size(); i++) {
ctrycook.clear();
if (ctry.get(i).getBrandId() == mPosition) {
ctry.get(i).getBrandType();
ctryCook.addAll(ctry.get(i).getBrandList());
break;
}
}
}
试试这段代码
private void initView() {
String js = loadJSONFromAsset(getActivity(), "brandtypes.json");
Gson g = new Gson();
Brandcookers p = g.fromJson(js, Brandcookers.class);
List<BrandCountryList> ctry = p.getCountryList();
List<BrandTypeBrandList> ctrycook = new ArrayList<>();
for (int i = 0; i < ctry.size(); i++) {
ctrycook.clear();
if (ctry.get(i).getBrandId() == mPosition) {
ctry.get(i).getBrandType();
ctryCook.addAll(ctry.get(i).getBrandList());
break;
}
}
}