1

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>
Dipsomania
  • 73
  • 11
Brandon Wilson
  • 4,462
  • 7
  • 60
  • 90
  • i think your api key is wrong. – Sunny Dec 02 '11 at 04:10
  • 1
    i just compare the api key length and your api key is too long. my api key is 0bBgLl42nWwnTf983Y5VdIgfZI6mC7meL7Ms_qg . i m just guessing, – Sunny Dec 02 '11 at 04:36
  • Tried different/new API and still nothing. Just a plain grid! This is the API that Google generated for me. – Brandon Wilson Dec 02 '11 at 04:37
  • again try generating key use keytool -list -alias androiddebugkey -keystore "C:\Users\pc.android\debug.keystore" -storepass android -keypass android **you can find path "C:\...." in eclipse window->preference->android->build.** – Sunny Dec 02 '11 at 04:42

3 Answers3

1

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

Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87
  • The key works and is correct. The maps were being display a few days ago and just stopped. I did not change code for the map view. It is strange that it just stopped working like it. There isn't much in Log Cat, just says that it is recycling map object. – Brandon Wilson Dec 02 '11 at 04:28
  • try this adding in your mapActivity.IF its shwoing error then remove * and try again – Tofeeq Ahmad Dec 02 '11 at 04:43
  • it will stop recycling of map object.And let me know it worked or not – Tofeeq Ahmad Dec 02 '11 at 04:44
0

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

super.onCreate(savedInstanceState);
        setContentView(R.layout.mainlayout);
Jovan
  • 1,741
  • 4
  • 19
  • 38
0

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");
}
Brandon Wilson
  • 4,462
  • 7
  • 60
  • 90