my layout is below. When I run it first time all is okay and I see the map:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@color/backNormal"
android:orientation="vertical"
>
<Button
android:id="@+id/buttonDriverAgreeYes"
android:gravity="center"
android:text='Agree'
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<fragment
android:id="@+id/map1"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
setContentView(R.layout.my_page1)
map1 = ((MapFragment) getFragmentManager().findFragmentById(R.id.map1))
.getMap();
But I get runtime error when I try to show this layout second time, or even when I try to show another similar layout with map named map2:
setContentView(R.layout.my_page2)
map2 = ((MapFragment) getFragmentManager().findFragmentById(R.id.map2))
.getMap();
Error message points on tag "fragment":
android.view.InflateException: Binary XML file line #60: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
Any ideas please? Thanks!