I'm wondering what's the better cleaner design approach to handle BroadcastReceiver creation between those two:
-
Declaring directly a BroadcastReceiver in an Activity/Fragment and overriding onReceived method there.
-
Creating another custom receiver class in a package "receiver", that extends the BroadcastReceiver class and override onReceive. Then, you instantiate that custom receiver class in your Activity/Fragment.
Aucun commentaire:
Enregistrer un commentaire