Android Retrofit2 Response Data, Null How To Fix It?
I just posted a similar question on Stack Overflow and learned how to handle it with the body, but I'm not sure what I'm doing wrong. Any help would be appreciated If the return co
Solution 1:
Hanumanjetlibrary.
implementation 'com.github.Pawan245:Hanumanjetlibrary:6.1.0'
Add implementation 'com.squareup.retrofit2:retrofit:2.6.1' in build.gradle file for declaration Call stringCall .
api service = RetrofitClient.getStringClient("http:/xyz.com/").create(api.class);
Call<String> stringCall = service.placeorder("8","1");
RetroApiAnyCall.ApiStringCallRetro(stringCall, newRetroApiAnyCall.RetroCallbackApi() {
@OverridepublicvoidonSuccess(String result) {
//do stuff here
}
@OverridepublicvoidonError(String result) {
//do stuff here
}
});
public interface api{
@FormUrlEncoded@POST("Api/details.php")
Call<String> placeorder( @Field("class_id") String id, @Field("sec_id") String secid );
}
Solution 2:
It was a response problem. The server did not send the value normally. According to the set rules.
thank you all
Post a Comment for "Android Retrofit2 Response Data, Null How To Fix It?"