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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:21:42+00:00 2026-06-04T09:21:42+00:00

This example is copied from a book on Android. As you can see from

  • 0

This example is copied from a book on Android. As you can see from my question, I am new to Android and trying to understand. This application should crash but it does not (I am updating UI from another thread. Which is not allowed.It should cause a crash. It does not. Why?). My code is:

final ProgressDialog dialogue = ProgressDialog.show(this, "title", "message");

       new Thread(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
                try {
                    Thread.sleep(7000);
                dialogue.dismiss();
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }



        }
    }).start();

This is done in OnCreate function. I am confused with line – dialogue.dismiss(); Isn’t that updating UI (dismissing dialogue) from another thread? Why does this app not cause segmentation fault?

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-06-04T09:21:44+00:00Added an answer on June 4, 2026 at 9:21 am

    the dismiss() method can be run safetly on any thread as described in the Android documentation.

    public void dismiss ()

    Since: API Level 1 Dismiss this dialog, removing it from the screen.
    This method can be invoked safely from any thread. Note that you
    should not override this method to do cleanup when the dialog is
    dismissed, instead implement that in onStop().

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

Sidebar

Related Questions

I'm trying to learn C++11 random stuff, so I've copied an example from this
I copied this code from an example . I've read it 100 times. Array.prototype.map
I copied this example from perldoc -f sort . I added the @old array
This is copied example from: How to read custom config section in app.config in
This example below illustrates how to prevent derived class from being copied. It's based
I copied this example from this topic. It's better to release the ivar directly.
I copied this example from api.jquery.com $('.target').change(function() { alert('Handler for .change() called.'); }); I
I am trying to implement this example here: Reading from and Writing to a
I copied this example from the FsUnit project page : open NUnit.Framework open FsUnit
Still fighting with templates. In this example, despite the fact that is copied straight

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.