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)
 http://commonsware.com 
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


 Thanks!



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Proguard issue with Adsense library.

Proguard seems to {*filter*}on the google ads library since I updated to ADT 
8.0.1 and started using the integrated support for proguard.

Here is the relevant output after ant release:

-obfuscate:
   [delete] Deleting: 
/home/benoit/android-sdk-linux_86/workspace/speedBones/bin/proguard/original.jar
      [jar] Building jar: 
/home/benoit/android-sdk-linux_86/workspace/speedBones/bin/proguard/original.jar
 [proguard] ProGuard, version 4.4
 [proguard] ProGuard is released under the GNU General Public License. The 
authors of all
 [proguard] programs or plugins that link to it (com.android.ant, ...) 
therefore
 [proguard] must ensure that these programs carry the GNU General Public 
License as well.
 [proguard] Reading input...
 [proguard] Reading program jar 
[/home/benoit/android-sdk-linux_86/workspace/speedBones/bin/proguard/original.jar]
 [proguard] Reading program jar 
[/home/benoit/android-sdk-linux_86/workspace/SpeedCore/libs/GoogleAdView.jar]
 [proguard] Reading library jar 
[/home/benoit/android-sdk-linux_86/platforms/android-8/android.jar]
 [proguard] Initializing...
 [proguard] Note: com.google.ads.AFMAUtil: can't find dynamically referenced 
class android.os.SystemProperties
 [proguard] Note: there were 1 unresolved dynamic references to classes or 
interfaces.
 [proguard]       You should check if you need to specify additional program 
jars.
 [proguard] Ignoring unused library classes...
 [proguard]   Original number of library classes: 2642
 [proguard]   Final number of library classes:    454
 [proguard] Printing kept classes, fields, and methods...
 [proguard] Shrinking...
 [proguard] Printing usage to 
[/home/benoit/android-sdk-linux_86/workspace/speedBones/bin/proguard/usage.txt]...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 110
 [proguard]   Final number of program classes:    83
 [proguard] Optimizing...
 [proguard] Unexpected error while performing partial evaluation:
 [proguard]   Class       = [com/google/ads/AFMAUtil]
 [proguard]   Method      = [c([B[B)[B]
 [proguard]   Exception   = [java.lang.ArrayIndexOutOfBoundsException] (-1)

BUILD FAILED
/home/benoit/android-sdk-linux_86/tools/ant/main_rules.xml:430: 
java.lang.ArrayIndexOutOfBoundsException: -1
at 
proguard.optimize.peephole.BranchTargetFinder.visitConstantInstruction(BranchTargetFinder.java:496)
at 
proguard.classfile.instruction.ConstantInstruction.accept(ConstantInstruction.java:161)
at 
proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:138)
at 
proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:110)
at 
proguard.optimize.peephole.BranchTargetFinder.visitCodeAttribute(BranchTargetFinder.java:358)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at 
proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:218)
at 
proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:180)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
at 
proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
at 
proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:439)
at 
proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
at proguard.classfile.ProgramClass.accept(ProgramClass.java:281)
at proguard.classfile.ClassPool.classesAccept(ClassPool.java:114)
at proguard.optimize.Optimizer.execute(Optimizer.java:345)
at proguard.ProGuard.optimize(ProGuard.java:325)
at proguard.ProGuard.execute(ProGuard.java:114)
at proguard.ant.ProGuardTask.execute(ProGuardTask.java:279)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
at org.apache.tools.ant.Project.executeTarget(Project.java:1329)
at 
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 5 seconds


It used to work with the old procedure described here:

 http://www.***.com/ 

Any idea?

-- 

2. Google fusion tables and android

I am a total beginner to android programming. I had an idea or two about 
what apps I would like to see, and decided to try and make them.

I have several books on android development, and they have been very helpful 
thus far, as has the net. I have made a few basic apps, ranging from ello 
worldto basic games and tabbed apps. My understanding of development for 
android is still pretty basic. Please take this into account ;)

Broadly I want to develop an app that can display user generated content on 
a google maps, like pillmaphttp://spillmap.org/

I know that I can use mymaps for this, but I have stumbled across google 
fusion tables, and for the potentially large amounts of geographic data 
involved this would be ideal. I have googled around the subject, but am at a 
loss as to how I would make android upload to fusion tables. I have come 
across a reference to someone doing this, so I know that it is possible. 

Any advice would be very welcome!

Merry Christmas!

-- 

3. How to implement a JUnit to test StatusBar and notification?

4. Problem with OnClick Interfering with OnTouch

5. Neither Map Activity noe Google Maps showing the maps

6. Publishing app . what should be done

7. Signed app.how to get LVL in source