Got some errors following the tutorial for MapView when i was going to integrate overlays.
TravelBuddy.java
package com.jappapps.android.travelbuddy;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
public class TravelBuddy extends MapActivity {
List<Overlay> mapOverlays;
Drawable drawable;
Overlays itemizedOverlay;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); // changed to lowercase
MapView mapView = (MapView) findViewById(R.id.mapview); // match id in main.xml
mapView.setBuiltInZoomControls(true);
mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.androidmarker);
itemizedOverlay = new Overlays(drawable);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
Overlays.java
package com.jappapps.android.travelbuddy;
import java.util.ArrayList;
import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
public class Overlays extends ItemizedOverlay {
public Overlays(Drawable arg0) {
super(arg0);
Object overlayitem;
ItemizedOverlay.addOverlay(overlayitem);
Object itemizedoverlay;
ArrayList<OverlayItem> mapOverlays;
mapoverlays.add(itemizedOverlay);
}
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
super(boundCenterBottom(defaultMarker));
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();}
@Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
@Override
public int size() {
return 0;
}
}
Sorry if i look like a complete newbie, but i am trying to learn and i got an awesome app idea which needs mapview, webview, overlays and tabs.