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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:08:46+00:00 2026-05-18T08:08:46+00:00

I have a service running a background thread. What I’d like to do is

  • 0

I have a service running a background thread. What I’d like to do is to
show an AlertDialog initiated from my background thread. I know that
this is not the recommended way of notifying the user and that it
interrupts the workflow (as they can pop-up in any application at any
time) but it’s a suitable way for my use case.

There is a handler registered with the background thread and showing a
Toast notification withing the handler works fine. But after switching
to an AlertDialog nothing happens anymore. My showDialog logic is
silently ignored. No Dialog window appears, no log entry. It’s a bit
strange as I’d expect at least a log entry saying that I’m doing
something wrong or whatever.

Are there any limitations for showing an AlertDialog initiated from a
service background thread? Some people seem to recommend a Dialog themed
Activity to get a similar behavior.

Any clarification or help making it work is greatly appreciated!

Yves

  • 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-18T08:08:46+00:00Added an answer on May 18, 2026 at 8:08 am

    It is possible to open a dialog from a background thread. The trick is to start an activity which looks like a dialog:

    <activity android:label="@string/app_name" android:name="YourDialog" android:theme="@android:style/Theme.Dialog"/>
    

    Then, to start your activity:

    Intent dialog = new Intent(this, YourDialog.class);
    dialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(dialog);
    

    Note that this is asyncrhonous and doesn’t block. If you want to process the result, you’ll have to use startService() and pass a custom activity to indicate a result.

    Emmanuel

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

Sidebar

Related Questions

I have a service that has its own thread running on background. I'd like
I have a service running in background. I started it from an Activity, but
I have a Windows Service running on a .Net 2.0 environment (NOT UPGRADABLE TO
I have a system service running on my Windows machine that can impersonate the
I have an echo web service running on lets say http://localhost:8080/axis2/services/Service1 . This service
I have a .NET Web Service running in VS2005 and a client that consumes
I have an ASP.NET web service running that accepts both HTTP POST and SOAP
I have a Service running in background with a timed event. Every 5 minutes
I have some code that can spawn background worker threads from anywhere within it.
I'm running some code in a background thread to get a text file from

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.