Search in sources :

Example 1 with AdminViewModel

use of com.shu.studentmanager.viewmodel.AdminViewModel in project student-manager by SYYANI.

the class AdminFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    adminViewModel = new ViewModelProvider(this).get(AdminViewModel.class);
    adminFragmentBinding = DataBindingUtil.inflate(inflater, R.layout.admin_fragment, container, false);
    adminFragmentBinding.setAdminViewModel(adminViewModel);
    adminFragmentBinding.setLifecycleOwner(getActivity());
    StudentManagerApplication application = (StudentManagerApplication) getActivity().getApplication();
    adminFragmentBinding.adminFramentTeacherId.setText(application.getId());
    adminFragmentBinding.adminFragmentTeacherName.setText(application.getName());
    View root = adminFragmentBinding.getRoot();
    return root;
// return inflater.inflate(R.layout.student_fragment, container, false);
}
Also used : AdminViewModel(com.shu.studentmanager.viewmodel.AdminViewModel) StudentManagerApplication(com.shu.studentmanager.StudentManagerApplication) View(android.view.View) ViewModelProvider(androidx.lifecycle.ViewModelProvider)

Aggregations

View (android.view.View)1 ViewModelProvider (androidx.lifecycle.ViewModelProvider)1 StudentManagerApplication (com.shu.studentmanager.StudentManagerApplication)1 AdminViewModel (com.shu.studentmanager.viewmodel.AdminViewModel)1