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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:26:32+00:00 2026-05-25T12:26:32+00:00

Doing some testing but cannot fabricate debug environment so maybe someone can answer this.

  • 0

Doing some testing but cannot fabricate debug environment
so maybe someone can answer this.

In my Activity i start an AsyncTask.
This AsyncTask is writing to Sqlite and it take long time.

I thought i could start the AsyncTask when user press the “Send” Button
and then hit the back button to finish() the Activity.

I know AsyncTask will keep on running even do Activity is finish() right.

The question is how do keep the fields alive?

What happen with the localArrayPeople in this code if parent finish()?

private class AsyncTaskDoStuff extends AsyncTask<Long, Integer, Integer> 
{
    ArrayList localArrayPeople;

    @Override
    protected Integer doInBackground(Long... params) {

        this.localArrayPeople =  arrayPeople;

        // Do stuff...
    }
}

I know i can/should use a Service but the amount of data/Object’s to send to the Service
is really much.
I know this is a bad ide so please for education purpose just answer the question and dont warn me

  • 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-25T12:26:33+00:00Added an answer on May 25, 2026 at 12:26 pm

    To answer yor question. Objects in java programs never just “go away”, so fields don’t loose references, e.g. suddenly start pointing to null. Objects are only removed by GC when nobody references them.

    In your case, when Activity stops, the fields in background thread will not be affected.

    The only problem could be that Android OS decides to remove your app from memory and kills all it’s threads. This can happen if you have a really long running background thread and your app is inactive (= activity not showing).

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

Sidebar

Related Questions

Hi am doing some testing on the Freebase sandbox, but I can't get the
I've been doing some performance testing around the use of System.Diagnostics.Debug, and it seems
I'm roughing a layout together and doing some browser testing. Never came across this
I'm just doing some testing with this, and I cant figure out if I
I am doing some testing in my iPhone app and I get this error:
I'm doing some unit testing, and mocking some properties using Moq . Now, this
I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster
I'm currently doing some GUI testing on a ASP.net 2.0 application. The RDBMS is
I'm a doing some blackbox testing of a ASP.Net website and I need to
I was working with quality yesterday doing some formal testing. In their procedure they

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.