double latitude = geoPoint.getLatitudeE6() / 1E6; double longitude = geoPoint.getLongitudeE6() / 1E6; location.setLatitude(latitude); location.setLongitude(longitude);
1E6
将为您节省更多字符。 — @stealthcopter:不是这样的。Location
明显缺少两个浮点数的构造函数(Location
甚至没有默认构造函数 - 您需要填写一个无用的提供程序)。 实际上,我会像Date
或String
一样使Location
成为不可变的。 - Martin