我有数组列表,我想获取id并将其放在带有retrofit2的@path接口中。因为当我想单击它时,我通过id获取视图属性。
我的界面
@POST("/api/statistic/v1.0/rawdata/{device_id}")
Call<EventsModel> listEventsById(
@Header("Authorization") String authtoken,
@Path("device_id")String device_id
);
我的片段
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
String encoding = Base64Encoder.encode(UtilsApi.username + ":" + UtilsApi.password);
api.listEvents( "Basic "+encoding,raw)
.enqueue(new Callback<EventsModel>() {
@Override
public void onResponse(Call<EventsModel> call, Response<EventsModel> response) {
if (response.code()==200){
events = response.body().getData();
// Log.d(TAG, "INI EVENTS: "+events.get(0).getProtocol());
eventsAdapter = new EventsAdapter(getContext(),events);
recyclerView.setAdapter(eventsAdapter);