3
I have a java class
public class PRODUTO extends SugarRecord implements Parcelable {
private float id_pro;
public PRODUTO(float id_pro){
this.id_pro = id_pro;
}
public float getId_pro() {
return id_pro;
}
public void setId_pro(float id_pro) {
this.id_pro = id_pro;
}
// PARCELABLE
public PRODUTO(Parcel parcel) {
setId_pro(parcel.readFloat());
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeFloat(getId_pro());
}
...
}
One API php that returns me one JSON of my base mysql, in it comes the id_pro, for example: 257895
But always add automatically one ".0" at the end of the variable AFTER ASSIGNING THE CLASS, thus: 257895.0
I already checked the return data, it comes right from JSON, but at the time of assigning the class is like this, in mysql base I have a field bigint that I’ve already switched to float also to test and did not give. However when I use String in the class for the id_pro, correctly receives 257895, but wanted to work directly in the object format.
Use a Httpurlconnection for the requisition.
Does anyone have any idea what I’m doing wrong?
Oops, thanks James, that’s right, as long he does not, thanks!
– Rodrigo