Actually not sure.. I just removed the shadow... here is the class:

public class userOverlay extends ItemizedOverlay<OverlayItem> {
        private List<OverlayItem> items;
        private Drawable marker;
        public userOverlay(Drawable defaultMarker) {
                super(defaultMarker);
                items = new ArrayList<OverlayItem>();
                marker = defaultMarker;
        }
        @Override
        protected OverlayItem createItem(int index) {
                return (OverlayItem)items.get(index);
        }
        @Override
        public int size() {
                return items.size();
        }
        @Override
        public void draw(Canvas canvas, MapView mapView, boolean shadow) {
                super.draw(canvas, mapView, false);
                boundCenter(marker);
        }
        public void addItem(OverlayItem item) {
                items.add(item);
                populate();
        }
}

And this is how I use it on my code:


protected void createAndShowUserOverlay(Location newLocation, float orientation) {
                  List<Overlay> useroverlays = mapView.getOverlays();
                        // first remove old overlay             
                        if (useroverlays.size() > 0) {
for (Iterator iterator = useroverlays.iterator(); iterator.hasNext ();) {
                                        iterator.next();
                                        iterator.remove();
                                }
                        }
                        // transform the location to a geoPoint
GeoPoint geopoint = new GeoPoint((int) (newLocation.getLatitude() * 1E6), (int) (newLocation.getLongitude() * 1E6));
                        Paint paint = new Paint();
                        Point pt  = new Point();
                        mapView.getProjection().toPixels(geopoint, pt);
Bitmap bmp = BitmapFactory.decodeResource(getResources (),R.drawable.user2);
                        Matrix matrix = new Matrix();
                        matrix.postTranslate(-25, -25);
                        matrix.postRotate(orientation);
                        matrix.postTranslate(pt.x, pt.y);
                        paint.setAntiAlias(true);
                        paint.setFilterBitmap(true);
                        int width = bmp.getWidth();
                int height = bmp.getHeight();
Bitmap changedBitmap = Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true);
                        BitmapDrawable icon = new BitmapDrawable(changedBitmap);
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
                        userOverlay useroverlay = new userOverlay(icon);
                        OverlayItem item = new OverlayItem(geopoint, "I'm 
here", null);
                        useroverlay.addItem(item);
                        mapView.getOverlays().add(useroverlay);
                        mapView.postInvalidate();
                }


On Sep 14, 2010, at 5:45 PM, TreKing wrote:

On Tue, Sep 14, 2010 at 11:26 AM, Pedro Teixeira <pedroteixeir...@gmail.com > wrote: I have no ideia why is this happening since the information is used just once.

Funny how these problems always come in pairs ...

I assume you're overriding onDraw? Did you look at the documentation for that function?

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Pedro Teixeira

www.pedroteixeira.org

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to