1

Android アプリを作成しており、Google マップの逆ジオコーディングを使用する必要があります。関連するコードは次のとおりです。

  Geocoder geoCoder = new Geocoder(getApplicationContext(), Locale.getDefault());
  List<Address> matches = geoCoder.getFromLocation(latitude, longitude, 1);
  // latitude and longitude are double variables containing the coordinates.

上記のコードの最初の行で、コンパイル エラーが発生します。

"The constructor Geocoder(Context, Locale) is undefined"

グーグルを試しましたが、解決策が見つかりませんでした。ありがとう。

4

1 に答える 1

1

コンストラクターGeocoder(Context, Locale)が定義されています。正しいクラスをインポートするかどうかを確認します

 android.location.Geocoder

ここにドキュメント

于 2013-05-16T17:47:23.347 に答える