私には 2 つの問題があります。1 つ目は、アドレスを取得して編集テキストに出力する String Builder があることです。
Geocoder mGC = new Geocoder(context,Locale.getDefault());
address = mGC.getFromLocation(lat, lng, 1);
if (address !=null){
Address currentAddr = address.get(0);
mSB = new StringBuilder();
for (int i=0; i<currentAddr.getMaxAddressLineIndex(); i++){
mSB.append(currentAddr.getAddressLine(i)).append(", ");
}
outputText.setText(mSB.toString());
}
問題は、行がランダムにaddress = mGC.getFromLocation(lat, lng, 1);
null ポインター例外を返すことです。数日間動作することもありますが、突然 null ポインター例外が発生します。誰かが理由を知っていますか?
また、私の 2 番目の問題は、GPS の修正に時間がかかることです。GPS 衛星を使用しています。最初にネットワークから提供された情報を使用し、次に GPS 衛星を使用してより迅速に修正する方法はありますか?