Android 改装项目列表始终为空
我试图从android应用程序上的WS获取项目列表,但响应总是空的 这是我的代码,我想不出来: 接口:Android 改装项目列表始终为空,android,json,retrofit,Android,Json,Retrofit,我试图从android应用程序上的WS获取项目列表,但响应总是空的 这是我的代码,我想不出来: 接口: public interface CategoriesInterface { @GET("/categories") List<CategorieModel> getCategories(@Query("k") String token); } @GET("/categories") CategorieContainer getCategories(@Query("
public interface CategoriesInterface {
@GET("/categories")
List<CategorieModel> getCategories(@Query("k") String token);
}
@GET("/categories")
CategorieContainer getCategories(@Query("k") String token);
响应JSON格式:
"categories": [
{
"id": "2",
"cat_pt": “STRING",
"cat_es": “STRING"
},
我不知道我做错了什么。响应列表始终为空
谢谢您的JSON返回一个CategoryContainer,其中包含一个CategorieModel数组。添加新的模型类:
public class CategorieContainer {
private List<CategorieModel> categories = new ArrayList<>();
// TODO Getter / Setter
}
当您在浏览器中实际访问该url时,会得到什么?有数据吗?“WS_URL”是正确的URL吗?URL是正确的,克里斯托弗·贝娄的回答很好。无论如何谢谢你谢谢你!工作完美
public class CategorieContainer {
private List<CategorieModel> categories = new ArrayList<>();
// TODO Getter / Setter
}
@GET("/categories")
CategorieContainer getCategories(@Query("k") String token);