我需要使用改造來執(zhí)行獲取請求,但在調(diào)用我的界面中的方法之后應(yīng)用程序崩潰。這是我必須得到的 JSON 代碼:[{ "username": "matteo", "conteggio": 5, "isYou": 0},{ "username": "giovanni", "conteggio": 7, "isYou": 1}]我得到它添加郵件作為參數(shù)所以這是我的界面:public interface ServerService{String BASE_URL="https://seconda.herokuapp.com/";@GET("total?mail={mail}")Call<List<GetListParameters>> getList(@Path("mail") String mail);}這是它崩潰的活動(此代碼是 OnClickListener):Retrofit retrofit=new Retrofit.Builder() .baseUrl(ServerService.BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .build(); ServerService ss=retrofit.create(ServerService.class); Call call=ss.getList(Mail); //the app crashes here call.enqueue(new Callback<List<GetListParameters>>() { @Override public void onResponse(Call<List<GetListParameters>> call, Response<List<GetListParameters>> response) { if(response.isSuccessful()){ ArrayList<UtenteAdapter> UtenteList=new ArrayList<>(); for(GetListParameters item: response.body()){ UtenteList.add(new UtenteAdapter(item.getUsername(), item.isYou(), item.getConteggio())); }我找不到我的錯(cuò)誤,非常感謝您的幫助。
使用改造的 GET 請求不起作用,應(yīng)用程序崩潰
繁華開滿天機(jī)
2022-06-04 17:20:28