eclipse - Android Map V2 map load in one activity but not in other two -


i new android map api v2. trying load map in 3 different activities(on user action), 1 one. map loads fine in 1 activity remaining show gray boxes zoom buttons.

following xml layout(map_view.xml) including in 3 different layouts using include tag.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >  <relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_margintop="10dp" >      <fragment         android:id="@+id/maplocationdetail"         android:layout_width="match_parent"         android:layout_height="match_parent"         class="com.google.android.gms.maps.mapfragment" />      <imageview         android:id="@+id/transparent_image"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:src="@android:color/transparent" />      <button         android:id="@+id/btnrefresh"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentright="true"         android:layout_marginbottom="10dp"         android:layout_marginright="10dp"         android:background="@drawable/btn_green_small"         android:text="direction"         android:textcolor="@color/white" /> </relativelayout> 

following code loading map in 1 activity. not in other 2.

package com.nthreads.out2b.activity.places; import android.os.bundle; import android.view.view; import android.widget.imageview; import android.widget.linearlayout;  import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.bitmapdescriptorfactory; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; import com.nthreads.out2b.out2b; import com.nthreads.out2b.r;  public class locationdetailactivity extends out2b { static final latlng hamburg = new latlng(53.558, 9.927); static final latlng kiel = new latlng(53.551, 9.993); private googlemap map;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_location_detail);      map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.maplocationdetail))             .getmap();     marker hamburg = map.addmarker(new markeroptions().position(hamburg)             .title("hamburg"));     marker kiel = map.addmarker(new markeroptions()             .position(kiel)             .title("kiel")             .snippet("kiel cool")             .icon(bitmapdescriptorfactory                     .fromresource(r.drawable.map_resturant_marker)));      // move camera instantly hamburg zoom of 15.     map.movecamera(cameraupdatefactory.newlatlngzoom(hamburg, 15));      // zoom in, animating camera.     map.animatecamera(cameraupdatefactory.zoomto(10), 2000, null);     map.getuisettings().setzoomcontrolsenabled(false); } 

map loading : enter image description here

not loading : enter image description here

i found alternatives of issue. code looking fine, not wrong code or include tag. main issue tabs, guess map working fine loading in activity , not working in tabs. suggest use view pager or make own controls show tabs. maps work in way.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo