use of com.shu.studentmanager.viewmodel.StudentViewModel in project student-manager by SYYANI.
the class StudentFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
studentViewModel = new ViewModelProvider(this).get(StudentViewModel.class);
studentFragmentBinding = DataBindingUtil.inflate(inflater, R.layout.student_fragment, container, false);
studentFragmentBinding.setStudentViewModel(studentViewModel);
studentFragmentBinding.setLifecycleOwner(getActivity());
StudentManagerApplication application = (StudentManagerApplication) getActivity().getApplication();
studentFragmentBinding.studentFragmentStudentId.setText(application.getId());
studentFragmentBinding.studentFragmentStudentName.setText(application.getName());
student_course_list_recyclerview = studentFragmentBinding.studentFragmentCourseListRecycleview;
setStudentCoureListRecycleView();
View root = studentFragmentBinding.getRoot();
try {
initStudentCourseList();
} catch (IOException e) {
e.printStackTrace();
}
return root;
// return inflater.inflate(R.layout.student_fragment, container, false);
}
Aggregations