we have found a strange thing with the mapViews. It shows our GPS-
position wrong.
If we tell the map to center it self around a big famous building in
Malmo, Turning Torso, GPS position: lat: 55.364784, long:12.583482.
Well then it centers it self in the sea.
If we try the Swedish royal castle instead with GPS position: lat:
58.193586, long: 18041811
It shows that place all wrong also. Including the simple code down
below, does anyone have a clue?
this is my onCreate Method in my class AndroidLBS that extends
MapActivity
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
MapView myMap = (MapView) findViewById(R.id.map);
ViewGroup zoom = (ViewGroup) findViewById(R.id.zoom);
zoom.addView(myMap.getZoomControls());
MapController mapController = myMap.getController();
mapController.setCenter(new GeoPoint(55364784, 12583482));
mapController.setZoom(15);
Drawable marker =
getResources().getDrawable(R.drawable.map_marker_red);
marker.setBounds(0, 0, marker.getIntrinsicWidth(),
marker.getIntrinsicHeight());
Friends friends = new Friends(marker);
myMap.getOverlays().add(friends);
}
catch(Exception e){
Log.e("Error", e.toString());
e.printStackTrace();
}
}
I also have this class to show a location with a marker
private class Friends extends ItemizedOverlay<OverlayItem>{
private List<OverlayItem> friends = new
ArrayList<OverlayItem>();
public Friends(Drawable marker) {
super(marker);
friends.add(new OverlayItem(new GeoPoint((int)
(59.193586*1E6),(int) (18.041811*1E6)),"Bruce Willis", "This is where
you are"));
populate();
}
private void addFriend(double latitude, double longitude,
String name){
friends.add(new OverlayItem(new GeoPoint((int)
(latitude*1E6),(int) (longitude*1E6)),"title not entered", name));
populate();
}
@Override
protected OverlayItem createItem(int i) {
return(friends.get(i));
}
@Override
public int size() {
return friends.size();
}
@Override
protected boolean onTap(int i){
Toast.makeText(androidLBS.this,
"location: lat: " +
Integer.toString(friends.get(i).getPoint().getLatitudeE6()) + " long:
"+ Integer.toString(friends.get(i).getPoint().getLongitudeE6()),
Toast.LENGTH_SHORT).show();
return true;
}
@Override
public void draw(Canvas canvas, MapView mapView, boolean
shadow) {
super.draw(canvas, mapView, false);
}
}
Please help!
Regards HTP
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---