use of com.shu.studentmanager.viewmodel.TeacherViewModel in project student-manager by SYYANI.
the class TeacherFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
teacherViewModel = new ViewModelProvider(this).get(TeacherViewModel.class);
teacherFragmentBinding = DataBindingUtil.inflate(inflater, R.layout.teacher_fragment, container, false);
teacherFragmentBinding.setTeacherViewModel(teacherViewModel);
teacherFragmentBinding.setLifecycleOwner(getActivity());
StudentManagerApplication application = (StudentManagerApplication) getActivity().getApplication();
teacherFragmentBinding.teacherFragmentTeacherName.setText(application.getName());
teacherFragmentBinding.teacherFramentTeacherId.setText(application.getId());
course_list_recycleview = teacherFragmentBinding.courseListRecycleview;
setCoureListRecycleView();
View root = teacherFragmentBinding.getRoot();
try {
initCourseList();
} catch (IOException e) {
e.printStackTrace();
}
return root;
// return inflater.inflate(R.layout.teacher_fragment, container, false);
}
Aggregations