3

Possible Duplicate:
Multiple MIME types in Android

I have a requirement wherein I have to let the user select either a photo or a video. Can this be done in a single intent? Currently I am asking user if he wants to select photo or a video and based on his input I set mime type of the intent either "image/*" or "video/*".

Is there a way to allow user to select photo/video in a single intent?

Thanks, Yogesh

Community
  • 1
  • 1
Yogesh
  • 311
  • 1
  • 10

2 Answers2

1

You can try out something like this:

android-file-dialog

This is allowing following feature too.

FORMAT_FILTER - files filter. If file name ends with one of filters the file will be displayed.

So, you can specify required filters with this and provide selection of different files to users.

Hope it helps you.

Thanks.

Pratik Sharma
  • 13,307
  • 5
  • 27
  • 37
0

Try this

Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("image/*");
startActivityForResult(Intent.createChooser(i, "Pick a photo"), requestCode);

Haven't tested the result, but the Intent is started correctly (I have tested that)

Robin Kanters
  • 5,018
  • 2
  • 20
  • 36