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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:09:55+00:00 2026-06-15T11:09:55+00:00

I have an Android Service that does some background processing on an image using

  • 0

I have an Android Service that does some background processing on an image using a separate Thread. If an error occurs in this Service or even worse in the thread, what is the best practice to inform the launching Activity of the problem and allow the application to recover to a stable state (i.e. the state it was in before launching the service).

From within the Service I could post a Toast or a Notification, but that doesn’t help me. I would like to inform the user about the problem but at the same time recover the application to a stable state.

  • 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-15T11:09:59+00:00Added an answer on June 15, 2026 at 11:09 am

    In case anyone searches for this I will explain what I ended up doing.

    Inside the service I added a private class that extends AsyncTask. This is were all the processing is done.

    In this class I have a private variable ‘exception’. The content of the doInBackground method is surrounded by a try/catch and any exception catched is stored in ‘exception’. In the onPostExecute method I check if ‘exception’ is set and if that is the case I send a broadcast PROCESSING_ERROR with the exception details so that the calling Activity will be informed.

    If you don’t know what AsyncTask, doInBackground or onPostExecute are you should read following:

    • http://developer.android.com/guide/components/processes-and-threads.html#AsyncTask

    • http://developer.android.com/reference/android/os/AsyncTask.html

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

Sidebar

Related Questions

In an android service I have created thread(s) for doing some background task. I
I need to have ALWAYS a background service that will synchronize my Android application
I have a Web Service and an Android application that uses this web service.
I have an Android Service that accesses the database about once per minute. Is
I have a php web service that takes the request from android/iphone app and
I have a comprehension question about Android Services. I have a Service that performs
I have developed a Service for Android that starts when BOOT_COMPLETED is received.It works
I currently have a Service in Android that is a sample VOIP client so
I have an android recurring service running in background, no Activity running in front
I'm developing an Android application that consists of: a lightweight background service that logs

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.