0
我在onPlaceSelected(Place place)方法中的主要活動我想在地圖片段中使用此設置標記位置在選定的位置。地圖片段是主活動中的一個片段(在導航抽屜中) ,我怎樣才能做到這一點 這裏是我的代碼..設置標記在自動完成搜索位置
@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("");
}
}
我有getLagLng()在主activity.how我得到它MapActivity擴展類片段 –