Dim
Dim

Reputation: 4807

How open default gallery app

I know it is asked before and I have tried:

Intent intent =  new Intent(Intent.ACTION_PICK);
intent.setType("video/*, images/*");
startActivity(intent);

But in my Samsung S2 it opens the gallery in selection mode (if I click an item it closes the gallery app). I just wish to open the gallery in normal mode so I can click images and videos and watch them and that is it!

I wasted too much hours for this.... Please help me!

Upvotes: 1

Views: 2291

Answers (4)

CommonsWare
CommonsWare

Reputation: 1006614

I just wish to open the gallery in normal mode so I can click images and videos and watch them and that is it!

There are countless "gallery" apps, both pre-installed on devices and available for download from the Play Store. There is no requirement for any of them to expose some specific Intent to show "normal mode", even assuming that the app has something that would correspond to "normal mode".

In other words, there is no reliable way to do what you seek.

Upvotes: 1

Renan Bandeira
Renan Bandeira

Reputation: 3268

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                  "content://media/internal/images/media"));

Font: https://stackoverflow.com/a/6016311/2652124

Upvotes: 0

SergioCruz
SergioCruz

Reputation: 1

This works for me:

Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file), "application/*");
        startActivity(intent);

Also check this link:

Using Intents to Open Files

Upvotes: -1

KickAss
KickAss

Reputation: 4280

Use

Intent intent = new Intent(Intent.ACTION_VIEW);

Reason

Activity Action: Display the data to the user. This is the most common action performed on data -- it is the generic action you can use on a piece of data to get the most reasonable thing to occur. For example, when used on a contacts entry it will view the entry; when used on a mailto: URI it will bring up a compose window filled with the information supplied by the URI; when used with a tel: URI it will invoke the dialer.

Output: nothing.

Upvotes: 4

Related Questions