event handler for holding a list item

by kingkung » Mon, 12 May 2008 22:10:32 GMT

Sponsored Links
 There is the onListItemClick() function for handling item clicks in a
list activity.

How do you handle events which should occur when a person presses and
holds down a list item for >2 secs or so?  There must be a way to
handle these events, since the Contacts application does so (holding
down something in a list will bring up a popup menu of choices).

Anyone have any idea?  Thanks.

event handler for holding a list item

by Mark Murphy » Mon, 12 May 2008 22:16:59 GMT

 > How do you handle events which should occur when a person presses and

That would be AdapterView#setOnItemLongClickListener().

Mark Murphy (a Commons Guy)
The Busy Coder's Guide to Android Development -- coming in June 2008!


Sponsored Links

event handler for holding a list item

by kingkung » Tue, 13 May 2008 18:29:02 GMT



Other Threads

1. Application not installed - anyone have thoughts as to why?

I have successfully installed my (first) app many times to my Nexus
One directly from Eclipse   But now I want to distribute it to some
testers.  So I exported it from Eclipse and created a signed version
and put it up on my web site.  When I download that version to my
phone and attempt to install it, it warns me that it is replacing an
existing version and shows me the usual list of things I have to agree
to (internet access, location, etc.).  But then when I accept, I get
the not-too-helpful message "Application not installed".  The log file
for this period is:

04-14 17:55:07.017: INFO/ActivityManager(70): Starting activity:
Intent { dat=file:///./sdcard/download/AutoMate.apk
cmp=com.android.packageinstaller/.InstallAppProgress (has extras) }
04-14 17:55:07.087: WARN/InstallAppProgress(2140): Replacing
04-14 17:55:07.228: WARN/AudioFlinger(52): write blocked for 207
msecs, 130 delayed writes, thread 0xd768
04-14 17:55:07.438: DEBUG/PackageParser(70): Scanning package: /data/
04-14 17:55:07.548: INFO/ActivityManager(70): Displayed activity
com.android.packageinstaller/.InstallAppProgress: 503 ms (total 503
04-14 17:55:07.728: DEBUG/dalvikvm(70): GC freed 2689 objects / 187168
bytes in 100ms
04-14 17:55:09.357: INFO/InstallAppProgress(2140): Finished installing

Any ideas on what the problem might be?


2. AVD emulator question...

Hi All,

When i start the AVD via the SDK/AVD manager that has one of the
default skins, then i get to see the keyboard alongwith the emulator

But when i customize the skin for the avd and then lauch it, i don't
get to see the keyboard part of the emulator.

Any idea on how to bring this keyboard part up?

The emulator and avd command line options did not seem to answer my



3. Ads in apps... How to successfully generate a larger revenue?

4. Google Search

5. How to create "unsynced" contacts and insert it in the system PhoneBook with Android 2.1?

6. Starting Text to Speech activity

7. Emma code coverage for UI events on device