Drawing item after added to the Overlay

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Drawing item after added to the Overlay

Postby ghostava » Sun Oct 13, 2013 1:01 pm

I use the OSMdroid. I want to implement my own overlay the MyOwnOverlayItem by extending the Overlay form the org.osmdroid.view.overlay package.

Here is my code:

Code: Select all
public class MyOwnItemizedOverlay extends Overlay {

   public MyOwnItemizedOverlay(Context ctx) {
      // TODO Auto-generated constructor stub

   private Canvas mCanvas;
   private MapView mapView;
   protected void draw(final Canvas c, final MapView osmv, final boolean shadow) {
      if(shadow) {
         if(mCanvas == null) {
            mCanvas = c;
         if(mapView == null) {
            mapView = osmv;
   public  void add(MyOwnOverlayItem item) {
      final Point point = new Point();
      mapView.getProjection().toMapPixels(item.getGeoPoint(), point);
                                                (float)point.x, (float)point.y, null);

And I receive the NullPointerException at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:104)

I do not know how to deal with it. Any suggestions ?
Thank in advance.
Once Poster
Once Poster
Posts: 1
Joined: Sun Oct 13, 2013 11:04 am


Return to Map Problems

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests