0

I want to ask if I use async task to send json for logging in the server, then I jump into another activities and create another async task for getting information which required user logged in. Will the login record lost due to moved to a new thread, which makes me cannot get that information?

1 Answers1

0
Will the login record lost due to moved to a new thread, 
which makes me cannot get that information?

Yes you are correct it will destroy all the data that was in your asynctask because the activity will call onDestroy and the GC/Garbage Collector will be performed thus data is gone.

solution:

You need to wait for your async task to send json for logging in the server and pass the login information in your Intent then use this Intent to jump to another activity. You can check this thread on how to pass information using Intent.

Community
  • 1
  • 1
Rod_Algonquin
  • 26,074
  • 6
  • 52
  • 63