refer to
This is a Android activity life cycle issue. I am seeing it in a main activity and then testing on device with the back button that goes back to a splash screen.
In the onPause() method.
Unregister the Broadcast Receiver that you created in the onCreate()
In the onRestart() re-register a brand new Broadcast Receiver.
In the activity class you need to keep a record of the Broadcast Receiver as instance data member.
SECOND
I think this also a feature enhancement issue with Android.
Sometimes developer need a broadcast receiver to outlive the activity. For example to understand when certain screen states are available or not. Think about a conversation context of work flow model, which has many states.
THIRD
You can register and unregister broadcast receivers with an activity, but a simple call like isRegistered(BroadcastReceiver) in the Activity class might be very useful.
If you need receivers to live beyond the activity, then I do not the answer, except to silence the warning, by adding unregister(X) in the onDestroy() call. YMMV ;-)
'Android Development' 카테고리의 다른 글
| SQLiteOpenHelper Singleton instance creating. (0) | 2013.07.04 |
|---|---|
| ndk-stack 으로 so 파일 debugging 하기 (0) | 2013.05.13 |
| NFC Guide (0) | 2013.05.08 |
| DDMS thread dump (0) | 2013.03.30 |
| ID3 TAG Parsing & Saving (0) | 2013.03.26 |