Skip to content

Instantly share code, notes, and snippets.

@paulocns
Last active August 4, 2018 22:20
Show Gist options
  • Save paulocns/0aeeba4b77786d53ffc48f5ca38f954a to your computer and use it in GitHub Desktop.
Save paulocns/0aeeba4b77786d53ffc48f5ca38f954a to your computer and use it in GitHub Desktop.
public class QueryFragment extends BaseFragment {
private FragmentQueryMvvmBinding binding;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_query_mvvm, container, false);
binding = DataBindingUtil.bind(view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
QueryViewModelArc queryViewModelArc =
ViewModelProviders.of(this, getViewModelFactory()).get(QueryViewModelArc.class);
binding.setViewModel(queryViewModelArc);
binding.setLifecycleOwner(this);
binding.executePendingBindings();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment