Question

I am trying to display a popup window in my view class (not in activity). Whenever the user touches a particular rectangle for like 3 sec, the popup window would appear.

Following this tutorial i found online(http://android-er.blogspot.sg/2012/03/example-of-using-popupwindow.html), it created the popup window in an activity class. How do i go about implementing this in a view class instead and how to check if the touch by user is at least 3 sec?

Please advice. Thank you.

Was it helpful?

Solution

TO make a popup window, use the PopupWindow class http://developer.android.com/reference/android/widget/PopupWindow.html

To see if a touch is 3 seconds, override the view's onTouch and store when a touch_down occurs and when a touch_up occurs check how long ago that down was.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top