Мне нужно добавить маркер к карте и автоматически сфокусироваться на этом маркере. Я следовал инструкциям Map project Загрузка карты на фрагмент, но маркер не отображается. Я новичок в андроиде. Я попробовал много примеров. Но ответа не нашел. Пожалуйста помоги. Спросите, нужна ли какая-либо дополнительная информация. Спасибо.Маркер карты не отображается
fragment_profile.xml
<fragment
android:id="@+id/map_fragment"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_below="@id/text_profile_location"
android:layout_marginTop="10dp"
android:layout_weight="1" />
FragmentProfile.java
public class FragmentProfile extends android.app.Fragment{
private GoogleMap googleMap;
private EditText textBirthdate;
public FragmentProfile() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_profile, container, false);
googleMap = ((MapFragment) this.getChildFragmentManager().findFragmentById(
R.id.map_fragment)).getMapAsync(this););
return rootView;
}
@Override
public void onMapReady(GoogleMap googleMap) {
double latitude = 37;
double longitude = 127;
MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");
Log.e("Latitude", "127");
// adding marker
googleMap.addMarker(marker);
CameraUpdate update = CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, longitude), 11);
googleMap.animateCamera(update);
}
}
Добавить еще код, где вы используете этот метод, и как вы фокусируетесь на этом маркере. –