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 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 windows service that runs various system monitoring operations. However, when running
I have a dotnet windows service that's currently hung, but running. Is there anyway
I have a background service running which sends out emails to users of my
I have an Android application with a background running Service. When the Service crashes
I'm running some code in a background thread to get a text file from
I have a WCF service running on the IIS with a ServiceHostFactory. It's running
I have a wcf application hosted in a windows service running a local windows
I've got a WCF service up and running on a server. We have a
We have a remoting singleton server running in a separate windows service (let's call
I have an importer process which is running as a windows service (debug mode

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.