我想在LifecycleObserver中使用LiveData,但是我必须传递一个Activity。我怎么得到这个?
public class ChatFragmentLifecycleObserver implements LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
void onCreate(LifecycleOwner owner) {
ChatViewModel chatViewModel = ViewModelProviders.of(*here I need the Activity*).get(ChatViewModel.class);
}