Android MapView Bitmap Problem
<p>The following Code should speed up my MapView because I'm handling a large set of routes. Unfortunately the "else" part does not draw anything. Could somebody help me to understand this. Thx</p>

<pre><code>    public boolean draw(Canvas canvas, MapView mapv, boolean shadow, long when) {

    if ((bmap == null) || (lastLatSpan != mapv.getLatitudeSpan())) {
        // bitmap is null - so we haven't previously drawn the path, OR
        // the map has been zoomed in/out, so we're gonna re-draw it anyway
        // (alternatively, I could have tried scaling the bitmap... might
        // be worth investigating if that is more efficient)

        // create a new bitmap, the size of the map view
        Canvas offscreencanvas = new Canvas();
        bmap = Bitmap.createBitmap(mapv.getWidth(), mapv.getHeight(),
                Bitmap.Config.ARGB_8888);
        offscreencanvas.setBitmap(bmap);

        Path path = null;

        Projection projection = mapv.getProjection();

        // lastLatSpan = mapv.getLatitudeSpan();

        for (int j = 0; j &lt; mTourenArray.length; j++) {
            GeoPoint[] route = GeoPointFactory
                    .createGeoPointArray(mTourenArray[j].getGeoPointArray());
            defaultColor = mTourenArray[j].getColorByCat();
            path = new Path();
            Paint polyPaint = new Paint();
            polyPaint.setColor(defaultColor);

            for (int i = 0; i &lt; route.length - 1; i++) {
                GeoPoint gp1 = route[i];
                GeoPoint gp2 = route[i + 1];

                if (shadow == false) {
                    polyPaint.setAntiAlias(true);
                    Point point = new Point();
                    projection.toPixels(gp1, point);
                    // mode=1&amp;#65306;start
                    if (i == 0) {
                        RectF oval = new RectF(point.x - mRadius, point.y
                                - mRadius, point.x + mRadius, point.y
                                + mRadius);
                        // start point
                        canvas.drawOval(oval, polyPaint);
                        Point point2 = new Point();
                        projection.toPixels(gp2, point2);

                        path.moveTo(point.x, point.y);
                        path.lineTo(point2.x, point2.y);
                    }
                    /* mode=3&amp;#65306;end */
                    else if (i == route.length - 2) {
                        /* the last path */
                        Point point2 = new Point();
                        projection.toPixels(gp2, point2);
                        path.lineTo(point2.x, point2.y);

                        RectF oval = new RectF(point2.x - mRadius, point2.y
                                - mRadius, point2.x + mRadius, point2.y
                                + mRadius);
                        /* end point */
                        polyPaint.setAlpha(255);
                        offscreencanvas.drawOval(oval, polyPaint);
                    }
                    // mode=2&amp;#65306;path
                    else if (i &lt; route.length - 2 &amp; i != 0) {
                        Point point2 = new Point();
                        projection.toPixels(gp2, point2);
                        path.lineTo(point2.x, point2.y);

                    }

                }
            }

            // create an off-screen canvas to prepare new bitmap, and
            // draw path on to it
            polyPaint.setStrokeWidth(5);
            polyPaint.setStyle(Paint.Style.STROKE);
            polyPaint.setAntiAlias(true);
            polyPaint
                    .setAlpha(defaultColor == Color.parseColor("#6C8715") ? 220
                            : 120);

            offscreencanvas.drawPath(path, polyPaint);

        } // Outer For End

        // draw the bitmap of the path onto my map view's canvas
        canvas.drawBitmap(bmap, 0, 0, null);

        // make a note of where we put the bitmap, so we know how
        // much we
        // we need to move it by if the user pans the map
        mapStartPosition = projection.fromPixels(0, 0);

    } else {
        // as we're in onDraw, we think the user has panned/moved the map
        // if we're in here, the zoom level hasn't changed, and
        // we've already got a bitmap with a drawing of the route path

        Projection proj = mapv.getProjection();

        // where has the mapview been panned to?
        Point offsetPt = new Point();

        proj.toPixels(mapStartPosition, offsetPt);
        Paint tmpPaint = new Paint();

        // create a new bitmap, the size of the map view
        // draw the bitmap in the new correct location
        canvas.drawBitmap(bmap, offsetPt.x, offsetPt.y, tmpPaint);

    }
    return super.draw(canvas, mapv, shadow, when);
}
</code></pre>
