Administrator
2021-10-27 2c2b6a3821d1e4ffbb2a0511d45943aae1992e55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.duqing.missions.ui.notifications;
 
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
 
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
 
import com.duqing.missions.databinding.FragmentNotificationsBinding;
 
public class NotificationsFragment extends Fragment {
 
    private NotificationsViewModel notificationsViewModel;
    private FragmentNotificationsBinding binding;
 
    public View onCreateView(@NonNull LayoutInflater inflater,  ViewGroup container, Bundle savedInstanceState) {
        notificationsViewModel = new ViewModelProvider(this).get(NotificationsViewModel.class);
        binding = FragmentNotificationsBinding.inflate(inflater, container, false);
        View root = binding.getRoot();
        notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
            @Override
            public void onChanged(@Nullable String s) {
            }
        });
        return root;
    }
 
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
 
}