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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:35:45+00:00 2026-06-01T03:35:45+00:00

I want to lock back button while my data process. I use AsyncTask to

  • 0

I want to lock back button while my data process.
I use AsyncTask to process data as below:

class Process extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog = new ProgressDialog(ShareFolderActivity.this.getParent());
progDailog.setMessage("Loading...");
progDailog.setIndeterminate(false);
progDailog.setMax(100);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
lock = true;
}
@Override
protected String doInBackground(String... aurl) {
//process
return null;
}
@Override
protected void onPostExecute(String unused) {
super.onPostExecute(unused);
PostLoad();
progDailog.dismiss();
lock = false;
}
}

And below onBackPressed():

@Override
public void onBackPressed() {
if(!lock) {
//back action
}
}

When at doInBackground back button be pressed, the back action not do, but the progDailog dismiss.
How can I modify to avoid it dismiss?

  • 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-01T03:35:47+00:00Added an answer on June 1, 2026 at 3:35 am

    You can call progDailog.setCancelable(false); to lock back button

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

Sidebar

Related Questions

want to know why String behaves like value type while using ==. String s1
I want to continue running my application when the back light and screen lock.
I just want to know how to kill a back ground process/app in iphone.
For my Android app I never want the phone to lock or the back
I have a database and want to lock it ... I know I can
I have a UIScrollView with a UIView inside. I want to lock the x-axis
I'm using SqlCipher with content providers. Right now, when I want to lock the
I want to add explicit lock on row which is currently being updated and
I want to permanently disable the lock in Android screen. i.e even after power
I have implemented ReaderWriterLockSlim, Now i don't want it to wait at the lock.

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.