gps中的Nullpointerexception,仅适用于特定设备:nexus 7、galaxy tab 2和asus tab

gps中的Nullpointerexception,仅适用于特定设备:nexus 7、galaxy tab 2和asus tab,gps,nullpointerexception,Gps,Nullpointerexception,nullpointerexception仅出现在特定设备中:nexus 7、galaxy tab 2和一些Asus tab设备。 初始化gps传感器: locManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 10000, 0, locListener); 我认为method onlocationchanged的对象位置与其他设备不同,需要做多少工作?真的不是gps传感器吗? 例外情

nullpointerexception仅出现在特定设备中:nexus 7、galaxy tab 2和一些Asus tab设备。 初始化gps传感器:

locManager.requestLocationUpdates(
                    LocationManager.GPS_PROVIDER, 10000, 0, locListener);
我认为method onlocationchanged的对象位置与其他设备不同,需要做多少工作?真的不是gps传感器吗? 例外情况是: 代码//

private void mostrarposion(位置loc){
尝试{if(loc!=null)
{双alturaf;
DecimalFormat df=新的DecimalFormat(“#”);
请尝试{longi=loc.getLongitude();}catch(NullPointerException e){textView1.setText(“错误经度”);longi=0;}
请尝试{lat=loc.getLatitude();}catch(NullPointerException e){textView1.setText(“错误纬度”);lat=0;}
如果(longi==0){longi=0.0000001;}
如果(lat==0){lat=0.00000001;}
如果(纬度>35&&longi(-24)){europa();}
//$

try-products异常是if(loc!=null)的行

在我的清单中:

<uses-feature android:name="android.hardware.location.gps" 
              android:required="true" />
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

我也有同样的问题。您找到解决方案了吗?
<uses-feature android:name="android.hardware.location.gps" 
              android:required="true" />
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />