Android GSon序列化双重到.net兼容

时间:2010-10-18 09:22:45

标签: android double gson

我有一个这样的pojo:

public class LocationPoint {

    protected double la;
    protected double lo;

    public double getLat() {
        return la;
    }

    public void setLat(double value) {
        this.la = value;
    }

    public double getLong() {
        return lo;
    }

    public void setLong(double value) {
        this.lo = value;
    }

}

场景: 在对MapView活动执行某些操作后,我将返回到名为id

的活动
if (resultCode == RESULT_OK) {

                    int latitude = data.getIntExtra("Latitude", 0); 
                    int longitude = data.getIntExtra("Longitude", 0);

                    if (latitude!=0 && longitude!=0)
                    {
                                                                                                                                                   LocationPoint p = new LocationPoint();
                        p.setLat((double) latitude);
                        p.setLong((double) longitude);
                    }

int latitude = 43802334,int longitude = 24825592 p中的转换值为:4.3802334E7和2.4825592E7

我希望double值没有E7,因为Web服务会因此而抛出错误。我做错了什么,不能理解为什么。你能给个建议吗?感谢

1 个答案:

答案 0 :(得分:0)

没关系,我只需要从地图意图发送纬度和经度为double和as clikcedLocation.getLatidudeE6 / 1E6