Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7433155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:34:18+00:00 2026-05-29T09:34:18+00:00

Is it possible to get control of the android image gallery from within my

  • 0

Is it possible to get control of the android image gallery from within my app? I am able to open the gallery and the image below, but however, whenever I click the back button, it returns me straight to my app, but I want the back button to go back to the gallery first then back to my app so that the user have to click the back button twice to go back to my app

My code is below:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("content://media/external/images/media"), "image/*");
        startActivityForResult(intent, 0); 

However with reference to the code below, I am able to allow user to go back to the gallery first then back to my app upon clicking the back button twice, but I am unable to allow user to open and view the image, meaning, once I click to launch the image, it straight away goes back to my app.

Code:

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

Any help would be greatly appreciated! Thanks in advance! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:34:19+00:00Added an answer on May 29, 2026 at 9:34 am

    to start changing the ‘Back’ button, behavior,
    you need to override the onKeyDown() method and than check if the desired button has been pressed:

    //Override the onKeyDown method

       @Override  
        public boolean onKeyDown(int keyCode, KeyEvent event)  
        {  
            //replaces the default 'Back' button action  
            if(keyCode==KeyEvent.KEYCODE_BACK)  
            {  
                //do whatever you want the 'Back' button to do  
                //as an example the 'Back' button is set to start a new Activity named 'NewActivity'  
                this.startActivity(new Intent(YourActivity.this,NewActivity.class));  
            }  
            return true;  
        }  
    

    this code overrides the OnKeyDown() method, that is called every time a key is pressed. The if statement inside this method checks if the ‘Back’ button has been pressed.
    If it does, the code inside the block will execute.

    @Override  
    public void onBackPressed()  
    {  
        //do whatever you want the 'Back' button to do  
        //as an example the 'Back' button is set to start a new Activity named 'NewActivity'  
        this.startActivity(new Intent(YourActivity.this,NewActivity.class));  
    
        return;  
    } 
    

    you can use your own activity and event into function .

    want more use Back Button Behaviour

    let me know if you want any more help!!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to get the ID assigned to User Control from the control
Is it possible to get a handle to an up-down control from a handle
I'm creating a PhoneGap app for Android. To get data from the (remote) server
Possible Duplicate: Get full path of a file with FileUpload Control I want to
Possible Duplicate: Get all files from VSS for a given date? I need to
Possible Duplicate: Get image data in Javascript? Convert an image into binary data in
Possible Duplicate: C# Get control by name I have been looking around for an
Is it possible get the assembly information from an imported MEF function? I need
i have an asp fileupload control, i want to know,,is it possible to get
Is it even possible to get JSON feed from Reddit and post it in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.