Android Architecture component LiveData - how to bind broadcastReceivers to lifecycle
问题 Using Android LiveData I'd like to be able to unregister and register many BroadcastReceiver s in the onInactive() and onActive() call backs. So I want to do something like this: public class BroadcastRecieverLiveData extends LiveData<BroadCastReciever> { private BroadcastReciever reciever; private Context context; public BroadcastRecieverLiveData(Context context) { this.context = context; } @Override protected void onActive() { IntentFilter filter = new IntentFilter(); filter.addAction("SOME