android - Can response and request data types be different? -
i mean call , response have different data types send json , string in response in retrofit2
call<user> call = client.createuser(user); call.enqueue(new callback<user>() { @override public void onresponse(call<user> call, response<user> response) { kik=response.body().getid(); log.d("fhjhh", ""+response.body().); } @override public void onfailure(call<user> call, throwable t) { string message = t.getmessage(); log.d("failure", message); } });
try this,
call<user> call = client.createuser(user); call.enqueue(new callback<user>() { @override public void onresponse(call<user> call, response<user> response) { user user = (user) response.body(); log.d(">>response",user.tostring()); } @override public void onfailure(call<user> call, throwable t) { string message = t.getmessage(); log.d("failure", message); } });
create tostring() method in model class called user.
Comments
Post a Comment