Rotate MapView

Problems with Canvas, OpenGL, etc...

Rotate MapView

Postby harmjanr » Thu Jun 09, 2011 9:49 am


I made a custom View: MyMapView which extends MapView. When I press a button from my app, I want to rotate the mapView. So I made a method onDraw with @Override annotation. I set a breakpoint in the onDraw method. When I press the button of the app, the breakpoint is hit and the map rotates. But when I press continue in the debugger, the breakpoint hits again and the map rotates back. Do I miss something in my code..??

My onDraw code:
Code: Select all
public void onDraw(Canvas canvas){
     if(polyLine != null){
          canvas.rotate(45f, centerX, centerY);
     polyLine = null;

The invalidate code when I hit the button:
Code: Select all

The first time that the breakpoint is hit, polyLine != null. The second time, polyLine is null.
I deleted some code in the onDraw method, to make my problem more clear. So polyLine is actually used in the if(), but not shown here :)

Please help.
Posts: 6
Joined: Thu Apr 14, 2011 8:55 am


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests