views:

450

answers:

1

In my app i let the user select one image from the media gallery. To do this i use the Intent.ACTION_PICK. Like

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, IMAGE_PICK);

The app works mostly fine, the users can select an image and the uri correctly.

The matter is in the gallery. If the user does a tap on an image all goes well, image is selected and uri returned. But if the user does a long click on an image, be it accident or on purpose, the phone vibrates a split sec, the image is focused, and then nothing happens. I understand on the formal gallery app this brings up a menu, but in this case it does nothing, and it can be confusing to users, to think they tapped and see the app do nothing.

So the question is, can i do anything to change the behavior of the long click in that screen? Like override the onLongClick or set an onLongClickListener or something?

Thanks in advance, best regards.

+1  A: 

Yes you can do both, onLongClick is the method and onLongClickListener is the callback for that method.

Anthony Forloney
But how can i access the method and callback in the gallery screen?
Arcantos
To achieve that, you might need to launch your own activity that shows gallery items and override it from there, I have tried looking online but nothing stands out to me.
Anthony Forloney
I dreaded that answer.But thanks for the insight.
Arcantos