我正在尝试从api动态获取数组的键名,而我已经获取并获取它的对象,所以这是api形式:
{
monday: [
{
mal_id: 37989,
url: "https://myanimelist.net/anime/37989/Golden_Kamuy_2nd_Season",
title: "Golden Kamuy 2nd Season",
},
{
mal_id: 36317,
url: "https://myanimelist.net/anime/36317/Gaikotsu_Shotenin_Honda-san",
title: "Gaikotsu Shotenin Honda-san",
},
{
mal_id: 38451,
url: "https://myanimelist.net/anime/38451/Reizouko_no_Tsukenosuke",
title: "Reizouko no Tsukenosuke!",
}
]
}
所以我试图让星期一在我的recycleview上方的文本视图中显示它 这是我的代码:
Call<SchedulesResponse> call = apiService.getSchedule();
call.enqueue(new Callback<SchedulesResponse>() {
@Override
public void onResponse(Call<SchedulesResponse> call, Response<SchedulesResponse> response) {
List<Schedule> monday = response.body().getMonday();
mondayRecyclerView.setAdapter(new MainAdapter(monday, R.layout.list_item_schedule, getApplicationContext(), MainActivity.this));
}
@Override
public void onFailure(Call<SchedulesResponse> call, Throwable t) {
// Log error here since request failed
Log.e(TAG, t.toString());
}
});
任何人的帮助