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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:52:27+00:00 2026-06-14T12:52:27+00:00

In the app i m looking for the users location using gps.In the Async

  • 0

In the app i m looking for the users location using gps.In the Async pre execute method i m showing a toast.I want that while i show that toast the back button should be disabled

aftr the location is found i want to enable the back button in the post execute!

to disable the back button i have used.But this is not working

 OnKeyListener mainScreenKeyListener = new OnKeyListener() {
                @Override
                public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                    boolean disableEvent = false;
                    if (event.getKeyCode()==KeyEvent.KEYCODE_BACK) {
                        disableEvent = true;
                    }

                    return disableEvent;
                }
            };
  • 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-14T12:52:28+00:00Added an answer on June 14, 2026 at 12:52 pm

    You can declare global variable disableEvent by

    final boolean disableEvent;
    

    Your Preexecute method can set it to false by

    disableEvent = false;
    

    Your Postexecute method can set it to true by

    disableEvent = true;
    

    You can override onBackPressed as shown below:

    @Override
        public void onBackPressed() {
            // TODO Auto-generated method stub
            if (disableEvent)
            {
                // do nothing
            }
            else
            {
                // do something
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NET app, where I allow Users to map a location using google maps and
Looking at doing an app that uses the phones location service and from what
Am looking into developing an iPhone native app using Titanium Developer Since this is
I am looking at a web-app, that has a set-up page(i.e, on the actual
I am looking into using Google App Engine for a project and would like
I'm looking for an SQL client app that can display subdatasheets like the following:
I'm currently looking at custom developed Web App Solution that is experiencing performance issues
I'm working on an iOS app that creates location sets where each row contains
How do I get my app to start updating GPS location as soon as
I'm looking to implement a location-based recommendation service in Python (as a Django app),

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.