Hi Pedro,

you can check how I do it in Farmácias (don't know if you know it). Here's
the relevant source file: http://goo.gl/3vrj
Check the onDraw Method.

On Mon, Sep 13, 2010 at 21:30, Pedro Teixeira <[email protected]>wrote:

> Hi there,
>
> I have a marker on the map using an Overlay..
> I also have access to the compass sensor which I'm able to show a
> textView with the orientation values ( 0 to 359 ) .. how can I apply
> this values to the marker? (which is a drawable)
>
> I already have a MAtrix created but when I insert the orientation
> value gives me an error, here it is:
>
> 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(direction);
>                        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);
>                        useroverlay.addItem(item);
>                        mapView.getOverlays().add(useroverlay);
>
> I used the value retrieved from the sensor on ''direction'' but it
> doesn't work.. anyway to work this around?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Reply via email to