Hello,
I have written a simple map application using the google API. I have
the apikey set and the map displays properly on the android phone.
However, there is always a red square on the bottom left of the map,
that I don't know how to get rid off.
Here is the URL of the snapshot:
http://picasaweb.google.com/mcornill/Screenshots#5399362615931619762
The java code is pasted below.
Any help is appreciated.
Thanks
Matt
import android.*;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.location.Address;
import android.location.Geocoder;
import android.view.*;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.android.maps.*;
import com.google.android.maps.MapView.LayoutParams;
import android.os.Bundle;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
public class MapsActivity extends MapActivity
{
static MapView mapView;
MapController mc;
GeoPoint p;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Allow zooming
mapView = (MapView) findViewById(R.id.mapView);
mapView.setSatellite(true);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
"Palo Alto, CA", 5);
String add = "";
if (addresses.size() > 0) {
p = new GeoPoint(
(int) (addresses.get(0).getLatitude() * 1E6),
(int) (addresses.get(0).getLongitude() *
1E6));
}
} catch (IOException e) {
e.printStackTrace();
}
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
and here is main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
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:enabled="true"
android:clickable="true"
android:apiKey="0oWLKpz0iuwLIE5KcYgcqCL0TPkzQOeWEOiUWOg"
/>
<LinearLayout android:id="@+id/zoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en