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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:01:22+00:00 2026-05-23T00:01:22+00:00

In my Android app, the main Activity will sometimes start a Thread to load

  • 0

In my Android app, the main Activity will sometimes start a Thread to load data from a server. This thread modifies the app’s database and edits some important files. AFAIK, it would appear that this thread continues to execute. What will happen to this thread if the Android gets into a low memory situation and decides to kill the entire Application? Will there ever be a situation were this thread might die prematurely? If so, is there any way I can see that the thread is being killed, and do something about it?

I’m asking because this thread modifies important data in the database, and if it is suddenly killed, the application could stop functioning properly.

  • 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-23T00:01:23+00:00Added an answer on May 23, 2026 at 12:01 am

    AFAIK, it would appear that this thread continues to execute.

    This is true but you have no guarantee of how long the thread will stay alive.

    What will happen to this thread if the Android gets into a low memory situation and decides to kill the entire Application?

    This is actually a fairly rare case in my experience but it will depend on the device’s available memory and the user’s behaviour, for example they use the device heavily and start multiple apps.

    Will there ever be a situation were this thread might die prematurely?

    Yes

    If so, is there any way I can see that the thread is being killed, and do something about it?

    No

    I’m asking because this thread modifies important data in the database, and if it is suddenly killed, the application could stop functioning properly.

    What you describe could be classed as something which is ‘mission critical’. As the other two answers have pointed out, a Service would be a more robust way of doing things as a Service is one of the last things to be ‘killed’ in a low memory situation. Using START_REDELIVER_INTENT may help in resuming what it was doing.

    In any case, if you have a ‘mission critical’ operation, you need to design your code for full recovery such as the use of transactions and the possibility of rollbacks in case of errors.

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

Sidebar

Related Questions

I'm working on an Android app that will look like this (Photoshop mockup): (source:
I'm trying to refactor/redesign an Android app. Currently, I've one UI activity ( Activity
I trying to put together an Android app that will take a picture and
I have a widget that supposed to call an Activity of the main app
I am working on an Android app that has multiple screens the user will
I am writing the code of an android activity that will display thumbnails of
I have an app, let us call it 'com.company.foo', with a main Activity 'FooBar'.
the Events class package org.examples.events; import android.app.ListActivity; import android.content.ContentValues; import android.widget.SimpleCursorAdapter; import android.database.Cursor; import
I just set up eclipse to start android development according to this http://developer.android.com/sdk/installing.html .
I'm building an Android app and I want to copy the text value of

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.