How do I set streetView in my mapview
- by John
I an working on an android project whereby i need to set my map to zoom in and show a more detailed view of my map, like the streets of where i want my coordinates to triangulate. The problem is in Mapview class, setStreetView is deprecated, wat is the alternative?
This is how setStreetView looks when i use it.
package com.HelloMapView;
import java.util.List;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.LinearLayout;
public class HelloMapView extends MapActivity {
MapView mapview;
LinearLayout linearlayout;
List<Overlay> mapOverlay;
Drawable drawable;
HelloItemizedOverlay itemizedOverlay;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapview=(MapView)findViewById(R.id.mapview);
mapview.setBuiltInZoomControls(true);
mapview.setStreetView(true);
mapOverlay=mapview.getOverlays();
drawable=this.getResources().getDrawable(R.drawable.androidmarker);
itemizedOverlay=new HelloItemizedOverlay(drawable);
GeoPoint geoPoint=new GeoPoint(19240000,-99120000);
OverlayItem overlayitem=new OverlayItem(geoPoint,"","");
itemizedOverlay.addoverlay(overlayitem);
mapOverlay.add(itemizedOverlay);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
this does not work it only shows square boxes with no map at all