0
メインアクティビティにonPlaceSelected(Place place)メソッドがあります。これをマップフラグメントで使用して、選択された位置にマーカー位置を設定します。マップフラグメントは、メインアクティビティ(ナビゲーションドロワー内) 、あなたは自分のonPlaceSelected
方法にオートコンプリート検索位置にマーカーを設定する
mMap.addMarker(new MarkerOptions().position(place.getLatLng()));
を追加する必要がありますどのように私はここに、この が私のコードで行うことができます。..
@Override
public void onPlaceSelected(Place place) {
Log.i(TAG, "Place Selected: " + place.getName());
// Format the returned place's details and display them in the TextView.
mPlaceDetailsText.setText(formatPlaceDetails(getResources(), place.getName(), place.getId(),
place.getAddress(), place.getPhoneNumber(), place.getWebsiteUri(),place.getLatLng()));
final CharSequence name = place.getName();
final CharSequence address = place.getAddress();
final LatLng location = place.getLatLng();
AppConstants.SHOW_SEARCH_LOCATION=address;
AppConstants.SHOW_SEARCH_LATLNG=location;
Log.d("placedetails",name+","+address+" "+location);
CharSequence attributions = place.getAttributions();
if (!TextUtils.isEmpty(attributions)) {
mPlaceAttribution.setText(Html.fromHtml(attributions.toString()));
} else {
mPlaceAttribution.setText("");
}
}
を断片クラスを拡張:
は、あなたがこのように取得することができますマップのインスタンスであります –mMap