場所を取得するときにこのエラーが発生しました。アプリケーションの起動時にエミュレータ制御を介して手動で座標を送信しますが、それでもこのエラーが発生します私のコードは
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//for getting location
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
ll = new MyLocationListener(etTextOut);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0 , 0, ll);
}
そして私のロケーションクラスは
public class MyLocationListener implements LocationListener {
EditText etTextOut;
public MyLocationListener(EditText etTextOut) {
// TODO Auto-generated constructor stub
this.etTextOut = etTextOut;
}
//public TextView tv;
@Override
public void onLocationChanged(Location loc) {
// TODO Auto-generated method stub
loc.getLongitude();
loc.getLatitude();
String msg = "Latitude:" + loc.getLatitude() + "\nLongitude:" + loc.getLongitude();
etTextOut.setText(msg);
}
メイン クラスの edittext に座標を設定し、ソケット経由で PC に送信したい