简体   繁体   中英

Tiles wont load with Map view but loads with fragment

i am trying to run this really simple app on my device (with maps API V2) and for some reason when trying to use MapView:

<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="(i did put the correct key)"
android:id="@+id/mvMap"/>

with the java file:

 public class MainMap extends MapActivity  {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_layout);
}
@Override
protected boolean isRouteDisplayed() {

    return false;
}

the tiles will not load!! but when I'm using a fragment: fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="fill_parent" android:layout_height="fill_parent" />

with - extends FragmentActivity in java file it works perfectly fine...

what is going on???

Please read this very good tutorial on how to implement GoogleMaps in Android: http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html

Without you posting any error message , there could be dozens of reasons why your map is not showing.

The following are the most common misstakes:

  • Forgot to set certain permissions
  • API key not obtained correctly
  • No Internet connection
  • GooglePlayServices not up to date on your device

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM