Я программно создаю фрагмент внутри FrameLayout и отображаю карту с помощью googlemap. Когда я запускаю его в первый раз, он показывает карту. Проблема в том, что когда я запускаю его во второй раз, он показывает мне пустую страницу. У кого-нибудь из вас есть обходной путь для этого? спасибо
Мой xml-файл - res / layout / activity_location
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map_layout"
android:layout_width="0dp"
android:layout_height="400dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
Сценарий
private void viewLocation()
{
setTitle("Location");
inflateView(frame, R.layout.activity_location);
final String TAG = "map";
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.add(R.id.map_layout, mapFragment = SupportMapFragment.newInstance(), TAG);
transaction.commit();
mapFragment.getMapAsync(this);
}