I'm writing an image application and I need to determine when an image is long pressed and do some processing on the image? I'm not sure how to listen to a long press for an image in the gallery?
Asked
Active
Viewed 64 times
1 Answers
0
Assuming you are using a view such as ImageView, you can use setOnLongClickListener() and pass it an OnLongClickListener to process your image.

Jeff
- 820
- 9
- 18
-
I'm new to android development so what I'm not understanind is that the view is not mine. It's android. So when a user clicks the gallery it's a view that is not part of my application. How do I hook into the gallery? – stack Aug 19 '12 at 06:00
-
To clarify the point a little more I"m not interested in showing the images in my own view. When the user clicks an image in the gallery I want to process the image. Maybe keep track of which images was clicked and display a report for example. – stack Aug 19 '12 at 06:10
-
Do a little more research I don't think this is possible since it's a different view. – stack Aug 19 '12 at 06:20
-
1Then you need to post some code and adjust your question because I don't fully understand it. The way I described above is a way to handle an image being long pressed which is what your original question asked. – Jeff Aug 19 '12 at 07:33
-
This will load the images into my activity. Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, 1); – stack Aug 19 '12 at 10:07
-
Clarification: when I said "Do a little more research..." I was referring to my self. I meant to say I did a little more research. – stack Aug 19 '12 at 14:38
-
Haha, yeah I was a bit confused by your "do a little more research.." comment. And could you post more of your code in your answer? You might want to check out [this answer](http://stackoverflow.com/questions/2169649/open-an-image-in-androids-built-in-gallery-app-programmatically) to see if this is what you're trying to do. If so, I'll add that to my answer above. – Jeff Aug 22 '12 at 06:08