I am new using retrofit and here i am stuck with an problem where retrofit always returns false for boolean type object which is actually 1(true) which i am retriving.
here below is my pojo class for retriving data
public class JobsModel implements Serializable {
@SerializedName("posted_on")
private String postedOn;
@SerializedName("is_active")
private boolean isActive=false;
public JobsModel(String postedOn, boolean isActive) {
this.postedOn=postedOn;
this.isActive=isActive;
}
public Boolean getPostedOn() {
return postedOn
}
public void setPostedOn(String postedOn) {
postedOn= postedOn
}
public Boolean getActive() {
return isActive;
}
public void setActive(Boolean active) {
isActive = active;
}
}
any help would be much appreciated
first of all change private boolean isActive=false; to private boolean Active;
Secondly change
public void setActive(Boolean active) {
isActive = active; }
to
public void setActive(boolean active) {
Active = active;
}
and If your JSON contains any object starting with I then change it,cause it will always return false. Hope this will be helpful to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With