Brandon Wilson
Brandon Wilson

Reputation: 4600

Maps Showing a Grid, no Maps Displayed

I got the map to view in the tab and it was working fine up till today. Keep in mind I have touched any code in for the map view since I got it working. All of a sudden nothing is being view on the map view anymore, just a the map grid. What would be causing this? I have tried a new API key and it does not seem to work. Google Maps loads everything fine. I even tried it on other phones, still just a grid.

maps class

package com.nyneaxis.api.gascloud;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.os.Bundle;
import android.widget.LinearLayout;

public class StationsMap extends MapActivity  {

    LinearLayout linearLayout;
        MapView mapView;

    public void onCreate(Bundle savedInstanceState){

        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

}

maps.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
            <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:apiKey="ABQIAAAAYc7mzgA4G-2FaBLUHTM_1xTjBItGPNb7O-Zq4IGUb6RxSdEi4RQ7Y-p4UARzkmuBTxknyrJRWOA31w"
    />

</RelativeLayout>

Upvotes: 1

Views: 1832

Answers (3)

Tofeeq Ahmad
Tofeeq Ahmad

Reputation: 11975

Include the map library in android-manifest file inside Application tag

<uses-library android:name="com.google.android.maps" />

And give Internet permission.As if you have correct map API Key then nothing seems wrong except this

Upvotes: 1

Brandon Wilson
Brandon Wilson

Reputation: 4600

This was the problem with the code. I had used this to log some activity in the main class. After failing at generating the keystore I finally started drilling into the code and removing bits of code I thought might be the problem. After removing everything I only had this left. I commenting the code and the maps worked again. I replaced all the original code and removed the onResume. Now everything is working as normal.

Thank everyone for all the help. Would any one be able to tell me why this little bit of code would prevent maps from loading? This literally racked my mind for a week.

    public void onResume(){
    super.onStart();
    Log.v(tag, "Task was resume");
}

Upvotes: 0

Jovan
Jovan

Reputation: 1741

Do you have on onCreate this, because I dont see it at your code:

super.onCreate(savedInstanceState);
        setContentView(R.layout.mainlayout);

Upvotes: 0

Related Questions