简体   繁体   English

如何在翻新android中从json对象获取值

[英]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} 一切正常,但是如何调用用户{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 请查看此链接https://www.androidtutorialpoint.com/networking/retrofit-android-tutorial/ ...我认为这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Retrofit 2和Android Studio获取JSON对象? - How get JSON Object with Retrofit 2 and Android Studio? 改造-如何从json对象获取响应 - retrofit - how to get response from json object Android 如何从 retrofit 获取 json 数组 - Android how to get json array from retrofit How to Get Json object and Json Array in Same KEY by retrofit for android - How to Get Json object and Json Array in Same KEY by retrofit for android How do I remove all null and empty string values from an object in json java android from retrofit? - How do I remove all null and empty string values from an object in json java android from retrofit? 如何从android(java)中的json响应中获取内部索引对象,该对象对rest api调用使用改造 - How to get inner indexed object from json response in android (java) which use retrofit for rest api calls 如何使用Retrofit从JSON对象获取密钥? - How can i get Key from JSON Object using Retrofit? Android:如何使用改型从json响应中获取特定字符串? - Android: How to get specific string from json response using retrofit? ANDROID:MVVM + Retrofit:我如何以及从何处从JSON对象数组中检索JSON对象列表? - ANDROID: MVVM + Retrofit: How and where shall I retrieve JSON Object List from JSON object array? Retrofit Android:如何获得 JSON 数据与 ZB9794896D699A6A78542122D3MVPC700 - Retrofit Android : How To Get JSON Data With Retrofit MVP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM