作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个位置:
public Location temp;
现在我想记住 map 上的一些坐标,所以我这样做:
双 a = 40.156729, b = 44.47197;
temp.setLatitude(40.156729);
temp.setLongitude(44.47197);
这会抛出 NullPointerException。我也这样试过:
double a = 40.156729, b = 44.47197;
temp.setLatitude(a);
temp.setLongitude(b);
还是一样。
日志:
06-05 09:32:55.720: E/AndroidRuntime(1370): Caused by: java.lang.NullPointerException
谢谢。
最佳答案
初始化变量
public Location temp = new Location("");
关于android - setLatitude setLongitude NullPointer 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10894982/
我有一个位置: public Location temp; 现在我想记住 map 上的一些坐标,所以我这样做: 双 a = 40.156729, b = 44.47197; temp.setLatit
我是一名优秀的程序员,十分优秀!