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 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 building an Android app and I want to copy the text value of
I'm building a mobile web app targeting Android users. I need to know what
I have two threads in an Android application, one is the view thread, and
Now that the G1 with Google's Android OS is now available (soon), will the
I am developing in app where I am using an activity in which I'm
My main activity has three check boxes in it. I want to be able
In Android, when layout out widgets, what's the difference between fill_parent ( match_parent in
I'm doing some Android development, and I much prefer Visual Studio, but I'll have
I understand the Android OS is based on Linux. Does that mean the G1
In my Android application, when I rotate the device (slide out the keyboard) then

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.