Detecting long touch press (ACTION_DOWN only)??

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


Sponsored Links
 Hi,
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
events.
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

android.view.GestureDetector;

android.view.GestureDetector.SimpleOnGestureListener;

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 :).

Best,

fr4gus




--


Sponsored Links


Other Threads

1. DOM2String

Hi

Is anyone knew how convert DOM object to String in Android 1.5? I can build
own recursive function, but I prefer some JAR library or trick in Android. I
will be glad if you could help me.

Best regards.

-- 
===============================
Wojciech Topolski
wojciech.topol...@gmail.com
===============================

-- 

2. Froyo coming July 13th - are you ready?

As many of you may have heard, Froyo is coming to the Verizon Droid
starting July 13th. That means millions of devices will be running
Froyo. There are a couple of important changes that need to be made in
order to be "Froyo compliant," here's what I've found:

Store app on SD card

This is a really easy modification, just add:
android:installLocation="auto"
ro your manifest statement and build with level 8.

The important change, and this one seems to be a lot more difficult to
find, is it seems Froyo is a lot more picky on null tests. Be sure
your app tests values for null or you'll get the dreaded FC.

Another thing you should do at this time is update your launcher icon.
The new flat style should be used at this point, along with adding the
various resolutions. This also is easy, just add the correct drawable
directories and the associated icons:

drawable - default, works with 1.5
drawable-hdpi - for "high" resolution devices
drawable-mdpi - for "medium" resolution devices

See: http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
for full details on inco specs.

Anyone have other tips for Froyo compliance?

-- 

3. Object Relational Mapping --- Tiny ORM on GitWeb

4. Center MapView on new added GeoPoint in ItemizedOverlay

5. VOOT: Undangan Launch Kompas Apps for iPad

6. Delete SD card contents

7. Launch intent in background then bring to foreground?