I am now forwading touch event to gestureDetector but let me know what to
add more ?
@Override
*public* *boolean* onTouchEvent(MotionEvent event){
*this*.detector.onTouchEvent(event);
*return* *super*.onTouchEvent(event);
}
@Override
*public* *boolean* onDoubleTap(MotionEvent e) {
// *TODO* Auto-generated method stub
mapView.getController().zoomIn();
*return* *false*;
}
@Override
*public* *boolean* onDoubleTapEvent(MotionEvent e) {
// *TODO* Auto-generated method stub
*return* *false*;
}
On Wed, Jul 7, 2010 at 5:23 PM, Michael MacDonald <[email protected]
> wrote:
> Maybe the problem is you are not forwarding touch events to the
> GestureDetector
>
> I would expect to see something like
>
>
> @Override
> public boolean onTouchEvent(MotionEvent evt) {
> return detector.onTouchEvent(evt);
>
> }
>
>
> On 07/06/10 21:07, zeeshan mirza wrote:
>
> Here is my own code which i have written up till now. I am trying to
> implement onDoubleTap() zoom in function in my application. My code is as
> follows. LEt me know where is the problem ? and if possible please add the
> correct code for double tap zoom in function.
>
> public class Maps extends MapActivity implements OnGestureListener,
> OnDoubleTapListener{
>
> private GestureDetector detector;
> MapView mapView;
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> //MapViewer mapViewer = new MapViewer(null, null);
> mapView = (MapView) findViewById(R.id.mapview);
> detector = new GestureDetector(this,this);
> mapView.setBuiltInZoomControls(true);
> }
> @Override
> protected boolean isRouteDisplayed() {
> return false;
> }
>
> public boolean onDoubleTap(MotionEvent e) {
> // TODO Auto-generated method stub
> mapView.getController().zoomIn();
> return false;
> }
> public boolean onDoubleTapEvent(MotionEvent e) {
> // TODO Auto-generated method stub
> return false;
> }
> public boolean onSingleTapConfirmed(MotionEvent e) {
> // TODO Auto-generated method stub
> return false;
> }
> public boolean onDown(MotionEvent e) {
> // TODO Auto-generated method stub
> return false;
> }
> public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
> float velocityY) {
> // TODO Auto-generated method stub
> return false;
> }
> public void onLongPress(MotionEvent e) {
> // TODO Auto-generated method stub
>
> }
> public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
> float distanceY) {
> // TODO Auto-generated method stub
> return false;
> }
> public void onShowPress(MotionEvent e) {
> // TODO Auto-generated method stub
>
> }
> public boolean onSingleTapUp(MotionEvent e) {
> // TODO Auto-generated method stub
> return false;
> }
> }
>
> On Fri, Jul 2, 2010 at 5:26 PM, TreKing <[email protected]> wrote:
>
>> On Wed, Jun 30, 2010 at 2:44 PM, SilentCoders <
>> [email protected]> wrote:
>>
>>> I need a sample code which i can use in my application.
>>
>>
>> No, you need to do your own work and ask specific questions when you get
>> stuck.
>>
>> Start with the Google Maps API documentation, the Hello MapView (or
>> whatever it's called) sample on the official documentation site. Review
>> handling touch events and start putting something together. If you get stuck
>> on something specific, come back, show what you've done and ask a specific
>> question someone may be able to help you out with.
>>
>>
>>
>> -------------------------------------------------------------------------------------------------
>> TreKing - Chicago transit tracking app for Android-powered devices
>> http://sites.google.com/site/rezmobileapps/treking
>> --
>> 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
>
>
> --
> 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