Hi, I'm having trouble with a background thread.
In SActivity, I want to use TService as in TActivity. If somehow, a task is not finished in TActivity, SActivity deals with the remaining task in the background thread.
For now, both SActivity and TActivity has a broadcast receiver to get the broadcast messages from TService.
However, it occurs an error when SActivity's background thread runs but the user invoke TAcitivity. (The error is that was originally registered here. Are you missing a call to unregisterReceiver()?) If I unregister the broadcast receiver in SActivity before TActivity starts, the background thread in SActivity cannot work.
Please guide me to solve this situation T_T
Thank you in advance.
(1) SActivity (MainActivity) (has a background thread and a broadcast receiver)
- Can move to TActivity from SActivity by users at any time
(2-2) TActivity (has a broadcast receiver) - (2-2-1)TService (extends IntentService, deals with bluetooth connection)
- If TService cannot finish the bluetooth task in a limted time, the task will be passed to SActivity's background thread
- Can move to TActivity from SActivity by users at any time
(2-2) TActivity (has a broadcast receiver) - (2-2-1)TService (extends IntentService, deals with bluetooth connection)
- If TService cannot finish the bluetooth task in a limted time, the task will be passed to SActivity's background thread
In SActivity, I want to use TService as in TActivity. If somehow, a task is not finished in TActivity, SActivity deals with the remaining task in the background thread.
For now, both SActivity and TActivity has a broadcast receiver to get the broadcast messages from TService.
However, it occurs an error when SActivity's background thread runs but the user invoke TAcitivity. (The error is that was originally registered here. Are you missing a call to unregisterReceiver()?) If I unregister the broadcast receiver in SActivity before TActivity starts, the background thread in SActivity cannot work.
Please guide me to solve this situation T_T
Thank you in advance.