使用REST API时获取异常

时间:2019-07-10 08:17:49

标签: android rest android-studio gson

我收到预期Begin_ARRAY的错误。但位于第{strong> 1列

行的BEGIN_OBJECTS

我正在尝试将URL中的数据导入recyclerview

 api = RetrofitClient.getApiClient().create(Api.class);

    Call<List<Courses>> call = api.getallcourse();

    call.enqueue(new Callback<List<Courses>>()
    {
        @Override
        public void onResponse(Call<List<Courses>> call, Response<List<Courses>> response) {
            Toast.makeText(Dashboard.this, ""+response.toString(), Toast.LENGTH_SHORT).show();
            courses = response.body();
            recyclerAdapter = new RecyclerAdapter(courses);
            recyclerView.setAdapter(recyclerAdapter);
        }

        @Override
        public void onFailure(Call<List<Courses>> call, Throwable t) {
            Toast.makeText(Dashboard.this, ""+t.toString(), Toast.LENGTH_SHORT).show();
        }

    });

0 个答案:

没有答案