Detecting long touch press (ACTION_DOWN only)??

by eminemence » Thu, 02 Sep 2010 01:55:07 GMT

Sponsored Links
I want to figure out how to detect that the user has been doing a long
touch press on the screen?
Most of the solutions that I see assume that the DOWN + UP sequence of
Thanks in advance.


Detecting long touch press (ACTION_DOWN only)??

by fr4gus » Thu, 02 Sep 2010 02:22:06 GMT

 If you don't have a requirement about how long should be the time to
trigger a long press, you could use



If you need to detect a long in a specific View object, what I do is
to register a OnTouchListener in my View object, that will redirect
the MotioEvent to the GestureDetector. At this point I'm able to
record what View was touched, and keep it in a variable of my current
Activity. Then in the gesture listener I took this variable and use
it. But if someone else knows a better approach I would like to hear
it :).




Sponsored Links

Other Threads

1. Status Bar appears again


I am developing a Home Screen and I have set the following attributes
in AndroidManifest.xml

as well as in onCreate() function as
// programatically setting the "No Status Bar" and "Fullscreen" for
this application

This works fine as long as my application starts running in the
foreground for the first time but once I activate any other
application by touching corresponding application icon and it (my
application) goes to background, the status bar appears when it
returns to foreground stays there.

Why it would have such characteristics even though I've explicitly
set above attributes.

Thanks in advance



2. Wtw Modaco Nexus S

Ada Yang punya link ROM Modaco buat NS
Mau coba.....


Regards : Cakra
Cyanogen Nexus S


3. From the Bottom of My Heart

4. Paging user Nexus S

5. Need Help in Android developement

6. Custom Drawable in OverlayItem in wrong location

7. How to open email in app with address