Issue
In My Map project , I have a map which occupies whole screen of the device in Main Activity. And I have some pins on the Map. If we press the pin ,it will lead to another Activity. There I have a map whose size is one third of the screen size. If we come to Main Activity from the another activity.
The Map in the Main Activity takes the size of Map in the another activity.
My Main activity xml is <
?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" >
<EditText
android:id="@+id/search"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/submit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
android:text="Search" />
</LinearLayout>
<com.xxx.yyy.FireMapView
android:id="@+id/mapview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/linearLayout1"
android:apiKey="xxxxxxxxxxx"
android:clickable="true" >
</com.xxx.yyy.FireMapView>
</RelativeLayout>
And My another activity xml is,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reportentry"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.xxx.yyy.FireMapView
android:id="@+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_weight="3"
android:apiKey="xxxxxx"
android:clickable="true" >
</com.xxx.yyy.FireMapView>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reportentry1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/a1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/add"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Address" />
<EditText
android:id="@+id/address"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/ft1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/ft2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="ft" />
<Spinner
android:id="@+id/ft3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/c"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/c1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="C" />
<EditText
android:id="@+id/c2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/p1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/p2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="p" />
<EditText
android:id="@+id/p3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/fc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/fc1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="fc" />
<Spinner
android:id="@+id/fc2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/cancel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Cancel" />
<Button
android:id="@+id/report"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Report" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Please provide me the correct way....
Thanks
Solution
As per docs android maintains one mapview instance per process. So, you can't maintain different mapview instances in single process.
If size is only your problem then while coming back to to your mainactivity call
mapView.getController.zoomIn();
mapView.getController.zoomOut();
in onRestart() of mainactivity.
It's not perfect solution but at least it worked for me.
This issue was already reported http://code.google.com/p/android/issues/detail?id=3756
Answered By - Sankar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.