2 回答

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊
onResponse在改造電話中使用它
call.enqueue(new Callback<List<Koor>>() {
@Override
public void onResponse(Call<List<Koor>> call, Response<List<Koor>> response)
{
koorArrayList = response.body();
Koor mKoor = koorArrayList.get(koorArrayList.size() - 1);
}
..............
在mKoor你有來(lái)自 Koor List 的最后一個(gè) Koor 對(duì)象

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超4個(gè)贊
你可以做到Arraylist.size()
@Override
public void onResponse(Call<List<Koor>> call, Response<List<Koor>> response) {
koorArrayList = response.body();
Koor e = koorArrayList.get(koorArrayList.size() - 1);
}
或者您可以簡(jiǎn)單地訪問(wèn)您的適配器
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
--------******************---------------------
Koor e = koorList.get(koorList.size() - 1);
--------******************---------------------
holder.x.setText(String.valueOf(koorList.get(position).getX()));
holder.y.setText(String.valueOf(koorList.get(position).getY()));
}
添加回答
舉報(bào)