0

I struggling to make my mapView rotate clockwise or counter-clockwise with using 2 finger touch and rotate. But I'm unable to achieve this. I'm using a navigational drawer, and my mapview is a fragment class. I'm not fully sure if I can insert touch event? I tried onTouchListener, but nothing basically happened. I even followed this: Android Two finger rotation But nothing. Can anyone suggest me how to manually rotate mapview?

My mapview is using osmdroid for android. And when I tried the above link, it was zooming rather rotating, not sure whether my listener was listening or not. Any other better methods where I can enable 2 finger gesture rotation of mapview on android?

Community
  • 1
  • 1
zIronManBox
  • 4,967
  • 6
  • 19
  • 35
  • possible duplicate of [Two finger rotation for OSMdroid mapview](http://stackoverflow.com/questions/21226036/two-finger-rotation-for-osmdroid-mapview) – kurtzmarc Mar 17 '14 at 12:48
  • Yes, I got it. I'd not seen my earlier post. Anyways thanks Kurtzmarc! – zIronManBox Mar 18 '14 at 03:43
  • Hi again, I did tried that. Unfortunately, it not working. I'm not sure what might be the problem. I'm running couple of cases, one with rotation enabled with respect to compass and other manual rotation. Its seems like its not even calling that class. Here the implementation: mRotationGestureOverlay = new RotationGestureOverlay(activity, mapView); mRotationGestureOverlay.setEnabled(false); mapView.getOverlays().add(this.mRotationGestureOverlay); – zIronManBox Mar 19 '14 at 04:12
  • Sorry again, I have it working. But the new problem is its very sensitive. A small 2finger touch and just drag is cause it to rotate 360deg multiple times. How can I control sensitivity? – zIronManBox Mar 19 '14 at 04:36
  • Apologize, I got it fixed. I took the absolute values to rotate.Thanks for your help! – zIronManBox Mar 19 '14 at 04:48
  • Was that a change you made to your code or osmdroid's code? – kurtzmarc Mar 19 '14 at 12:52
  • My code itself and not osmdroid's code. But I do face different problem, sometimes when I render map the osmdroid doesn't load all the tiles or it misses loading tiles at some portions. Can't predict when it happens but multiple times I've noticed this. And by either zoom in or out it readjusts. Is this a problem with my code or osmdroid? – zIronManBox Mar 20 '14 at 06:01
  • I would check the osmdroid issues page and try to find an existing issue that matches what you are seeing. I believe there are people experiencing similar problems especially with offline maps. – kurtzmarc Mar 20 '14 at 13:30
  • Another clarifications, after I do rotation, how can I reset back to original state? Like initially it is NorthUp, how can i get back to the same state after manual rotation? – zIronManBox Mar 27 '14 at 04:33
  • setMapOrientation(0) should do it. – kurtzmarc Mar 27 '14 at 15:21
  • I did try that, its not resetting back. Should I do invalidate? What i'm doing is rotating mapview based on compass, and turning off , the mapview gets stuck at that position. When I run back to setMapOrientation(0), nothing seems to happen. – zIronManBox Mar 28 '14 at 05:38
  • Not sure what's up. Take a look at RotationGestureOverlay line 79. We do the same thing there. – kurtzmarc Mar 28 '14 at 14:15

0 Answers0