Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle map not show any thing in map
    text
    copied!<p>i am showing a map in activity ... but when i run app on device it does not show any thing , it show just white screen and zoom in zoom out options... MAP key is right .. thanks ..</p> <p>AndroidManifest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.edxample.finalmap" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;permission android:name="com.edxample.finalmap.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="com.edxample.finalmap.permission.MAPS_RECEIVE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.edxample.finalmap.MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBL8ANi3jKkM0tF65C_Qus2_JgWRzClhfU" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>activity_main.xml</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" &gt; &lt;fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:map="http://schemas.andoid.com/apk/es-auto" android:name="com.google.android.gms.maps.SupportMapFragment" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>MainActivity</p> <pre><code>package com.edxample.finalmap; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.widget.Toast; public class MainActivity extends FragmentActivity { private GoogleMap googleMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(check()) { setContentView(R.layout.activity_main); Toast.makeText(this, "In Google play service.", Toast.LENGTH_LONG).show(); initFun(); } else { Toast.makeText(this, "Google play service not available.", Toast.LENGTH_LONG).show(); } } private Boolean check() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(status==ConnectionResult.SUCCESS) { return true; } return false; } public void initFun() { SupportMapFragment sp = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); googleMap = sp.getMap(); googleMap.setMyLocationEnabled(true); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload