Skip to content Skip to sidebar Skip to footer

How To Open Gallery Via Intent Without Result?

I have a kind of an ApplicationLauncher that has to start the build-in gallery. But I don't want to get any result from that gallery. I just want to start it and want my 'Launcher'

Solution 1:

Intentintent=newIntent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_VIEW );
    startActivity(intent);

Solution 2:

I just want to start it and want my "Launcher" to close after that.

Call finish() after you call startActivity() to close up your "Launcher".

Solution 3:

Since it doesn't seem to be possible to open the gallery via an Intent to just browse pictures (without the intent to select one which is then passed back to your application) like when starting the gallery from the launcher, the only solution I found is to explicitly state the package and Activity name in the Intent. For example:

// For Android 4.0 (Samsung Galaxy Nexus)finalIntentintent=newIntent();
intent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.Gallery");
startActivity(intent);

or

// For Samsung Galaxy S2finalIntentintent=newIntent();
intent.setClassName("com.cooliris.media", "com.cooliris.media.Gallery");
startActivity(intent);

Of course this solution isn't flexible at all and you would have to keep a list of package/activity names in your application and sending Intents (catching ActivityNotFoundException) until you found the right one.

Solution 4:

Calling finish in your launcher and clearing the activity stack may help, but your problem is probably related to the fact that your intent is Intent.ACTION_GET_CONTENT.

Looks like you're trying to get content from the gallery, and that is what it is doing. Try ACTION_VIEW instead.

Post a Comment for "How To Open Gallery Via Intent Without Result?"