Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Osmdroid has the functionality to zoom. You will need to setup a gesturelistener to check for the pinch action, at which point you should call the zoom function in osmdroid. I believe in osmdroid 3.0.5 it is something like</p> <p><code>mOsm.getController.setZoomLevel(someNumber)</code> (mOsm is an instance of the map view). </p> <p>I have the zoom function working for the opposite pinch (you fingers start close together and then expand). I suggest using a MotionEvent (like you are currently doing) and doing something like this: </p> <pre><code>boolean finished = false; @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { case MotionEvent.ACTION_DOWN: finished = false; break; case MotionEvent.ACTION_MOVE: finished = false; break; case MotionEvent.ACTION_UP: //action is finishing at this point, so now I can do my refreshActionOnMap(); if (!finished) refreshActionOnMap(); break; } return true; } </code></pre> <p>The code I have added deals with the pinch - the finished boolean is something I implemented in my program to figure out when to refresh the map. That should help you out more.</p> <p><a href="http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847" rel="nofollow">Here</a> is a further explanation of this. </p> <p>If you are looking for something different, then try reading <a href="http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html" rel="nofollow">here</a>. Android has been supporting the pinch action since June 2010 apparently.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload