[android-developers] Re: Listening to Double Taps in MapView
I was able to make it work but now the navigation on the map is not working. any ideas? thanks On Jun 12, 3:11 pm, Georgy georgearna...@gmail.com wrote: Would please provide me a copy of your code? I don't know why I can't gget it to work. thanks On Jun 12, 2:58 pm, Keith Wiley kbwi...@gmail.com wrote: Hmmm, I just added this functionality to my own project and it works like a charm. Let's see. To get this going you need a few things. The class that will receive your callback must implement the GestureDetector.OnDoubleTapListener interface, for which it must include implementations of onSingleTapConfirmed(), onDoubleTap(), and onDoubleTapEvent(). In addition, I generally include as a member of that class a GestureDetector object (I frequently include and use OnGestureListener as well but I don't think that's relevant to this discussion). Then, you must register your interest in the associated callbacks, somewhere around the time of onCreate(), via some code like this: mGestureDetector = new GestureDetector(this); mGestureDetector.setOnDoubleTapListener(this); That should get it going. One other thing I did was override dispatchTouchEvent(), at the end of which I call: return mGestureDetector.onTouchEvent(event); ...but I'm not at all sure you *need* to do this to get double taps rolling. I was using dispatchTouchEvent() for some other things. On Jun 12, 9:59 am, Georgy georgearna...@gmail.com wrote: still it doesn't get the double taps... On Jun 12, 12:57 pm, Keith Wiley kbwi...@gmail.com wrote: If I'm understanding you correctly, you *named* your handler method setOnDoubleTapListener(). That's not right. That's the callback setup method you call, passing it the object that you want called back to in the event of a double tap. The callback method is then some other name. In your case, I found the following: http://developer.android.com/reference/android/view/GestureDetector.O... which suggests you need to write a method with the following signature: boolean onDoubleTap(MotionEvent e); On Jun 12, 9:08 am, Georgy georgearna...@gmail.com wrote: Hello, I was able to listen to user touches or taps on the screen in a MapView and trigger a dialog giving the user some feedback. I need to implement the same concept but with double tap to trigger another dialog. I looked around and couldn't find much... I wrote this function: public void setOnDoubleTapListener(MotionEvent event, MapView mapView) { if (event.getAction() == MotionEvent.ACTION_UP) { Dialog dialog1 = new Dialog(HelloMapView2.this); dialog1.setTitle(Current Location); dialog1.setContentView(R.layout.custom); TextView current_locode = (TextView) dialog1.findViewById (R.id.text); current_locode.setText(Current LoCode: ); dialog1.show(); } but the compiler never goes through it when I double tap. any ideas? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Listening to Double Taps in MapView
If I'm understanding you correctly, you *named* your handler method setOnDoubleTapListener(). That's not right. That's the callback setup method you call, passing it the object that you want called back to in the event of a double tap. The callback method is then some other name. In your case, I found the following: http://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener.html which suggests you need to write a method with the following signature: boolean onDoubleTap(MotionEvent e); On Jun 12, 9:08 am, Georgy georgearna...@gmail.com wrote: Hello, I was able to listen to user touches or taps on the screen in a MapView and trigger a dialog giving the user some feedback. I need to implement the same concept but with double tap to trigger another dialog. I looked around and couldn't find much... I wrote this function: public void setOnDoubleTapListener(MotionEvent event, MapView mapView) { if (event.getAction() == MotionEvent.ACTION_UP) { Dialog dialog1 = new Dialog(HelloMapView2.this); dialog1.setTitle(Current Location); dialog1.setContentView(R.layout.custom); TextView current_locode = (TextView) dialog1.findViewById (R.id.text); current_locode.setText(Current LoCode: ); dialog1.show(); } but the compiler never goes through it when I double tap. any ideas? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Listening to Double Taps in MapView
still it doesn't get the double taps... On Jun 12, 12:57 pm, Keith Wiley kbwi...@gmail.com wrote: If I'm understanding you correctly, you *named* your handler method setOnDoubleTapListener(). That's not right. That's the callback setup method you call, passing it the object that you want called back to in the event of a double tap. The callback method is then some other name. In your case, I found the following: http://developer.android.com/reference/android/view/GestureDetector.O... which suggests you need to write a method with the following signature: boolean onDoubleTap(MotionEvent e); On Jun 12, 9:08 am, Georgy georgearna...@gmail.com wrote: Hello, I was able to listen to user touches or taps on the screen in a MapView and trigger a dialog giving the user some feedback. I need to implement the same concept but with double tap to trigger another dialog. I looked around and couldn't find much... I wrote this function: public void setOnDoubleTapListener(MotionEvent event, MapView mapView) { if (event.getAction() == MotionEvent.ACTION_UP) { Dialog dialog1 = new Dialog(HelloMapView2.this); dialog1.setTitle(Current Location); dialog1.setContentView(R.layout.custom); TextView current_locode = (TextView) dialog1.findViewById (R.id.text); current_locode.setText(Current LoCode: ); dialog1.show(); } but the compiler never goes through it when I double tap. any ideas? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Listening to Double Taps in MapView
Hmmm, I just added this functionality to my own project and it works like a charm. Let's see. To get this going you need a few things. The class that will receive your callback must implement the GestureDetector.OnDoubleTapListener interface, for which it must include implementations of onSingleTapConfirmed(), onDoubleTap(), and onDoubleTapEvent(). In addition, I generally include as a member of that class a GestureDetector object (I frequently include and use OnGestureListener as well but I don't think that's relevant to this discussion). Then, you must register your interest in the associated callbacks, somewhere around the time of onCreate(), via some code like this: mGestureDetector = new GestureDetector(this); mGestureDetector.setOnDoubleTapListener(this); That should get it going. One other thing I did was override dispatchTouchEvent(), at the end of which I call: return mGestureDetector.onTouchEvent(event); ...but I'm not at all sure you *need* to do this to get double taps rolling. I was using dispatchTouchEvent() for some other things. On Jun 12, 9:59 am, Georgy georgearna...@gmail.com wrote: still it doesn't get the double taps... On Jun 12, 12:57 pm, Keith Wiley kbwi...@gmail.com wrote: If I'm understanding you correctly, you *named* your handler method setOnDoubleTapListener(). That's not right. That's the callback setup method you call, passing it the object that you want called back to in the event of a double tap. The callback method is then some other name. In your case, I found the following: http://developer.android.com/reference/android/view/GestureDetector.O... which suggests you need to write a method with the following signature: boolean onDoubleTap(MotionEvent e); On Jun 12, 9:08 am, Georgy georgearna...@gmail.com wrote: Hello, I was able to listen to user touches or taps on the screen in a MapView and trigger a dialog giving the user some feedback. I need to implement the same concept but with double tap to trigger another dialog. I looked around and couldn't find much... I wrote this function: public void setOnDoubleTapListener(MotionEvent event, MapView mapView) { if (event.getAction() == MotionEvent.ACTION_UP) { Dialog dialog1 = new Dialog(HelloMapView2.this); dialog1.setTitle(Current Location); dialog1.setContentView(R.layout.custom); TextView current_locode = (TextView) dialog1.findViewById (R.id.text); current_locode.setText(Current LoCode: ); dialog1.show(); } but the compiler never goes through it when I double tap. any ideas? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Listening to Double Taps in MapView
Would please provide me a copy of your code? I don't know why I can't gget it to work. thanks On Jun 12, 2:58 pm, Keith Wiley kbwi...@gmail.com wrote: Hmmm, I just added this functionality to my own project and it works like a charm. Let's see. To get this going you need a few things. The class that will receive your callback must implement the GestureDetector.OnDoubleTapListener interface, for which it must include implementations of onSingleTapConfirmed(), onDoubleTap(), and onDoubleTapEvent(). In addition, I generally include as a member of that class a GestureDetector object (I frequently include and use OnGestureListener as well but I don't think that's relevant to this discussion). Then, you must register your interest in the associated callbacks, somewhere around the time of onCreate(), via some code like this: mGestureDetector = new GestureDetector(this); mGestureDetector.setOnDoubleTapListener(this); That should get it going. One other thing I did was override dispatchTouchEvent(), at the end of which I call: return mGestureDetector.onTouchEvent(event); ...but I'm not at all sure you *need* to do this to get double taps rolling. I was using dispatchTouchEvent() for some other things. On Jun 12, 9:59 am, Georgy georgearna...@gmail.com wrote: still it doesn't get the double taps... On Jun 12, 12:57 pm, Keith Wiley kbwi...@gmail.com wrote: If I'm understanding you correctly, you *named* your handler method setOnDoubleTapListener(). That's not right. That's the callback setup method you call, passing it the object that you want called back to in the event of a double tap. The callback method is then some other name. In your case, I found the following: http://developer.android.com/reference/android/view/GestureDetector.O... which suggests you need to write a method with the following signature: boolean onDoubleTap(MotionEvent e); On Jun 12, 9:08 am, Georgy georgearna...@gmail.com wrote: Hello, I was able to listen to user touches or taps on the screen in a MapView and trigger a dialog giving the user some feedback. I need to implement the same concept but with double tap to trigger another dialog. I looked around and couldn't find much... I wrote this function: public void setOnDoubleTapListener(MotionEvent event, MapView mapView) { if (event.getAction() == MotionEvent.ACTION_UP) { Dialog dialog1 = new Dialog(HelloMapView2.this); dialog1.setTitle(Current Location); dialog1.setContentView(R.layout.custom); TextView current_locode = (TextView) dialog1.findViewById (R.id.text); current_locode.setText(Current LoCode: ); dialog1.show(); } but the compiler never goes through it when I double tap. any ideas? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---