简体   繁体   中英

how to get the values from json object in retrofit android

All the thing working fine but how to call the the user{first_name,last_name,email}

在此处输入图片说明

在此处输入图片说明

You have to call a retrofit method in this way,

 @FormUrlEncoded
  @POST("employer/login")
  Call<ResponseModelEmplyrLogin> loginEmployer(

        @Field("data") String data);


 public void loginEmployer(String data, final MyApiCallbackEmplyrLogin<EmployrDataBean> callback) {
    ApiInterface apiService = ApiClient.createService();

    Call<ResponseModelEmplyrLogin> call = apiService.loginEmployer(data);
    call.enqueue(new Callback<ResponseModelEmplyrLogin>() {
        @Override
        public void onResponse(Call<ResponseModelEmplyrLogin> call, Response<ResponseModelEmplyrLogin> response) {
          //Write your code
        }

        @Override
        public void onFailure(Call<ResponseModelEmplyrLogin> call, Throwable t) {
           //Write your code
        }
    });
}

Check out this link https://www.androidtutorialpoint.com/networking/retrofit-android-tutorial/ ...I think this will be helpful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM