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

  • SEARCH
  • Home
  • 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 6701255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:54:44+00:00 2026-05-26T06:54:44+00:00

I have an activity where I start the built-in camera using onActivityResult. After taking

  • 0

I have an activity where I start the built-in camera using onActivityResult. After taking a picture, I go back to my application and show a pop up asking to the user if he wants to take more pictures or no. It works fine, but after taking the picture, when I press the “save” button on the built-in camera app, and inmediatly I press the home button, If I go back to my application, my activity is visible but not active and the popup that should be visible is there but I cannot see it. If I press the back button and cancel the pop up, my activity is active again, but I dont want to allow the user cancelling the pop up, so when this behavior occurs, I cannot use my app, I just have to kill it…

The question is, how can I force to the dialog being always on the top if it is shown? Cause seems like it is behind the activity, waiting for the user to interact with it…

Thanks!

  • 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-26T06:54:45+00:00Added an answer on May 26, 2026 at 6:54 am

    The easiest way I’ve found to fix this is to track the lifetime of the dialog in the activity and do a hide()/show() in the onResume for the activity. This solution only works for a single Dialog up at a time but could easily be adapted to more if required.

    1) Make your activity implement Dialog.OnDismissListener.
    2) Add an instance variable for the current Dialog in your Activity:

    private Dialog currentDialog = null;
    

    3) In onResume() add:

    if(currentDialog != null) {
        currentDialog.hide();
        currentDialog.show();
    }
    

    4) For each dialog created in onCreateDialog(), add:

    dialog.setOnDismissListener(this);
    currentDialog = dialog;
    

    5) Finally, add:

    @Override
    public void onDismiss(DialogInterface dialog) {
        if(dialog == currentDialog)
            currentDialog = null;
    }
    

    That seems to fix it for me.

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

Sidebar

Related Questions

I have an application and every new created activity will start an async task
I have a simple game activity. I start it and than press the back
I want to start in built gallery activity for multiple selection. I have tried
I have a activity which start with a alertdialog when i press back button
I have an activity with two buttons, start and stop. If the user press
I have the following problem: I have an Activity where a user can start
I have this situation where i have to start an activity from my mainActivity.
In my app have a sign in activity. If login is successful, I start
I would like to start a broadcast receiver from an activity. I have a
I have an activity that starts after a certain time. Once this activity starts,

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.