views:

34

answers:

3

Hey guys, I´ve got a small problem im stucked with. I have a kind of an ApplicationLauncher that has to start the build-in gallery. But I dont want to get any result from that gallery... I just want to start it and want my "Launcher" to close after that.

What ive tried:

    Intent intentBrowseFiles = new Intent(Intent.ACTION_GET_CONTENT);
    intentBrowseFiles.setType("image/*");
    intentBrowseFiles.setFlag(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intentBrowseFiles);

but it doestn even work with this flag... as soon as I click on a pic in the gallery, it closes and returns to my "Launcher". Is there any way to achieve what i want to do? Thanks in advance, Max

+1  A: 

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".

CommonsWare
thanks for your comment. If I do so, my App closes ofcourse, but the gallery keeps closing after I click on pic and i´m landing on the androids main-menu
max
@max: Well, what are you expecting to happen?
CommonsWare
I would like to start the gallery as a new application with all its functionality like when i open the gallery from the androids main-menu. I dont want any results or smt like that... i just want it to open and keep going... but like i said, it closes when i click on a pic =/
max
@max: `ACTION_GET_CONTENT` is not your answer, then. AFAIK, there is no documented `Intent` to launch the Gallery application. Hence, I suggest you discontinue this feature.
CommonsWare
allright, thanks for that important information!
max
A: 

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.

Jon
Hey Jon, I also tried ACTION_VIEW with an Runtime-exception as result: "unable to start activity"
max
A: 

<<<<<<<<<<<<<<<< deleted >>>>>>>>>>>>>>>>>

max