Я хочу установить ответ от API в RecylerView в текстовом виде. Но я не могу установить значения ниже
Это мой ответ от API
{
"message": "slot_time",
"success": "200",
"result": [
{
"morning": [
"08:00AM",
"08:30AM",
"09:00AM",
"09:30AM",
"10:00AM",
"10:30AM",
"11:00AM",
"11:30AM"
]
}
]
}
Мой основной класс активности
private void getSlotes(String date) {
GetDataService mGetDataService = RetrofitClientInstance.getRetrofitInstance(getApplicationContext()).create(GetDataService.class);
SharedPref.init(AppConstant.FILENAME, getApplicationContext());
String userID = SharedPref.getUserId(AppConstant.USER_ID, "");
String type = SharedPref.getScheduleType(AppConstant.TYPE, "");
String channelID = SharedPref.getChannelID(AppConstant.CHANNEL_ID, "");
Call<SlotsResponse> call = mGetDataService.getSlots(userID, dID, channelID, type, date);
call.enqueue(new Callback<SlotsResponse>() {
@Override
public void onResponse(@NonNull Call<SlotsResponse> call, @NonNull Response<SlotsResponse> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
ArrayList<Result> morningList = new ArrayList<>();
for (int i = 0; i < response.body().getResult().size(); i++) {
try {
morningList.add(response.body().getResult().get(i));
} catch (Exception e) {
e.printStackTrace();
}
}
mMorningAdapter = new MorningSlotAdapter(morningList, getApplicationContext());
mornigRecyclerView.setAdapter(mAdapter);
}
}
}
@Override
public void onFailure(@NonNull Call<SlotsResponse> call, @NonNull Throwable t) {
Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
}
});
}
Здесь я пытаюсь установить значение в классе адаптера, но значение равно null
public MorningSlotAdapter(ArrayList<Result> list, Context mContext) {
this.list = list;
this.mContext = mContext;
}
@Override
public void onBindViewHolder(@NonNull SlotViewHolder holder, int position) {
holder.slotTime.setText(list.get(position).getMorning().get(position));
}
Я много пробовал, но у меня не работает Я застрял в этой проблеме