如何通过改型获得json arraylist

时间:2019-05-11 04:02:11

标签: java android

我想接收这个json数组的第一个和最后一个。 这是使用邮递员的回复

[
 [
    441942680,
    "-6.831712",
    "107.443804",
    "2019-05-05T13:47:03.000+07:00",
    17
 ],
 [
    441942719,
    "-6.831906",
    "107.444124",
    "2019-05-05T13:47:08.000+07:00",
    17
 ],
 [
    441942755,
    "-6.832156",
    "107.444453",
    "2019-05-05T13:47:13.000+07:00",
    17
 ], ...
]

和我的方法

mApiService.getHistory(token,units,startDate,endDate)
            .enqueue(new Callback<Playback>() {
                @Override
                public void onResponse(@NonNull Call<Playback> call, @NonNull Response<Playback> response) {

                    progressBar.setVisibility(View.GONE);

                    if (response.isSuccessful()){
                        assert response.body() != null;
                        playbackList = response.body().getPlayback();

                        todayAdapter = new TodayAdapter(playbackList, getActivity());
                        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
                        recyclerView.setLayoutManager(layoutManager);
                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                        recyclerView.setAdapter(todayAdapter);
                        Log.d(TAG, "onResponse: "+playbackList);
                    }
                }

                @Override
                public void onFailure(@NonNull Call<Playback> call, @NonNull Throwable t) {
                    progressBar.setVisibility(View.GONE);
                }
            });

我的问题是我不知道这样打电话吗?我真的需要一个答案和解释

0 个答案:

没有答案