Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Map V2 Display Blank and show only zoom button?

i use the google map v2 and display the multiple marker but first i want to display the map on the screen i put down my all the files here is gives only blank i will check it out all but nothing work for me

enter image description here

main.xml

<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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

        <fragment
                    android:id="@+id/mapview"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    class="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mapactivity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />  
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />        
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <permission
        android:name="com.example.stiptis.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.stiptis.permission.MAPS_RECEIVE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.stiptis.MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>
          <meta-data
                    android:name="com.google.android.maps.v2.API_KEY"
                    android:value="your api key" />
    </application>

</manifest>

Activity class

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

    }



}
like image 463
start android Avatar asked Apr 12 '13 06:04

start android


People also ask

Why is my Google Maps screen blank?

This problem generally happens when you have too many bugged cookies in your browser or cached data in your Android app. The best solution to blank Google Maps is getting rid of the unwanted data from your mobile app or web browser.

How do I get Google Maps back to normal?

Click on the question mark enclosed in a gray speech bubble on the bottom right of the map. You'll see this dialog where you can get help. At the bottom there's an option to Return to classic Google Maps. Click it.

How do I fix Google Maps zoom?

To fix Google maps zooming problems, for Google maps default zoom you want to know how to change the zoom level on Google Maps. You can change the zoom level by going to the Edit map page and then selecting 'default zoom level' in the map information section and then clicking save map.

How do I add a zoom button to Google Maps?

To navigate, press the arrow keys. Below is a list of the full set of controls you can use in your maps: The Zoom control displays "+" and "-" buttons for changing the zoom level of the map. This control appears by default in the bottom right corner of the map.


1 Answers

Probably there is a problem with your Maps API Key. Put this function into your activity, and see what it logs for the correct SHA key:

 private void getShaKey() {

 try {
 PackageInfo info = getPackageManager().getPackageInfo("your.package.name",
 PackageManager.GET_SIGNATURES);
 for (Signature signature : info.signatures) {
 MessageDigest md = MessageDigest.getInstance("SHA");
 md.update(signature.toByteArray());
 Log.v(TAG, "KeyHash:" + Base64.encodeToString(md.digest(),
 Base64.DEFAULT));
 }
 } catch (NameNotFoundException e) {
 e.printStackTrace();

 } catch (NoSuchAlgorithmException e) {
 e.printStackTrace();

 }

 }
like image 84
Analizer Avatar answered Oct 21 '22 04:10

Analizer