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 9011167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:39:29+00:00 2026-06-16T02:39:29+00:00

EDITED & SOVLED (below) I need to make a kind of last-check when the

  • 0

EDITED & SOVLED (below)

I need to make a kind of last-check when the user is leaving the Activity.
If the result of this check is unsuccess, I need to not allow him to go out.

I need a kind of this:

@Override
protected void onPause() {
    if (comprobations == true){
        super.onPause();
        } else {
            NOT EXIT!!
        }
}

It seems easy :p but I tried and don’t runs.

Anyone can help me?

Thaanks

SOLUTION:

Thanks to all of you for the quick answers!
Every of them helped me and I have learned some new things.

I have tried the onBackPressed() method, this is what I was looking for.
I know that the user is still able to exit from the App by pressing the Home button and some another ways, but I just want to prevent users to think the configuration of my App is ok when they go back to the main menu; if they wish to go out from the App, it’s ok.
So I will do something as this:

@Override
public void onBackPressed() {
    Log.d(LOGTAG, "onBackPressed");
    if (COMPROBATIONS() == true){
        super.onBackPressed();
    } else {
        SHOW WARNING!
    }
    return;
}

Thanks to everybody fo your help.
Have a nice time.

  • 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-06-16T02:39:31+00:00Added an answer on June 16, 2026 at 2:39 am

    There is nothing you can do to prevent the user from leaving your Activity. Once the onPause method has been called, the application is going into the background and there is nothing you can do to stop it.

    If you really want to do something when the user is leaving your activity, it’s possible to override the back button by overriding the on onBackPressed() method and get it to do some other action. However, the user will still be able to leave in a variety of ways (pressing the home button for example).

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

Sidebar

Related Questions

EDITED & SOVLED (below) I'm using Java for Android trying to send the byte
edited: This is what i need: sendpost = function(a,b,c){ return jQuery.post('inc/operations.php', {a:b}, c, json);
EDITED: this first version was a false example with false assumptions! See below for
Edited at the request of commenters. I hope this is compliant. First post! Trying
EDITED I'm using Twitter Bootstrap and need to move navbar right( not float:right, but
Edited Question: This should be clear. using System; namespace UpdateDateTimeFields { class Program {
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
EDITED FOR TYPO - How can I check one thing AND THEN another, if
I edited a post of mine with this question, yet got no answers. I
I have a jQuery accordion from this site and edited for my purposes, but

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.