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){
super.onDraw(canvas);
if(polyLine != null){
canvas.rotate(45f, centerX, centerY);
}
polyLine = null;
}
The invalidate code when I hit the button:
- Code: Select all
mapView.setPolyLine(polyLine);
mapView.invalidate();
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.

