0

I'm storing my latitude and longitude in content provider as a real type.

When I retrieve it using a cursor, I use .getDouble, which means now this is a double.

This method accepts lat and long in only int type newGeoPoint ( latitude, longitude )

When I tried converting lat and lon from double to int, I get java null pointer exception.

This is what I tried Int(latitude * 1E6); Can you shed some light on this?

Update

I converted this double value to string then passed it to toast, I'm getting the values in toast. Now the problem is, how do I convert from double to int with out losing the float part.

Thanks in advance!!

4

1 回答 1

0

乘法后尝试强制转换:

int longitude = (int) (longitudeInDouble * 1E6)
于 2012-06-01T13:32:05.030 回答