MapView not working [android]

Tutorials that use the MapActivity. Many using GPS functionality.

MapView not working [android]

Postby girshiit07 » Thu Jul 07, 2011 1:57 pm

Hi All,


When I load my MapView application, the MapView only displays the grey grid lines.

Here is my Code:

main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0aOphT3vlZFVSL1HZ2Vg-RmIDhH0nPlp8e7gJrg"/>

Manifest File:

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

<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps"></uses-library>
<activity android:name=".GMapsActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="1" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>

</manifest>

Activity:

package com.andoid.googlemaps;

import android.os.Bundle;

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

public class GMapsActivity extends MapActivity {
private MapView mapView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

/* Proxy Settings*/
System.setProperty("http.proxySet", "true");
System.setProperty("http.proxyHost", "proxy.example.com");
System.setProperty("http.proxyPort", "8080");

setContentView(R.layout.main);
mapView=(MapView)findViewById(R.id.map_view);
mapView.setBuiltInZoomControls(true);

}

@Override
protected boolean isRouteDisplayed() {
return false;
}
}

Thanks in advance for any help...
girshiit07
Freshman
Freshman
 
Posts: 4
Joined: Fri Jun 17, 2011 7:42 am

Top

Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests