1
wxr
2022-01-11 5f82f0310a19cc6ee25ffadcff1e33f3ca2f7e44
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
40
41
42
43
44
45
46
47
package com.hdl.onproumengsdk;
 
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
 
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
 
import com.hdl.onproumengsdk.databinding.FragmentSecondBinding;
 
public class SecondFragment extends Fragment {
 
    private FragmentSecondBinding binding;
 
    @Override
    public View onCreateView(
            LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState
    ) {
 
        binding = FragmentSecondBinding.inflate(inflater, container, false);
        return binding.getRoot();
 
    }
 
    public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
 
        binding.buttonSecond.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NavHostFragment.findNavController(SecondFragment.this)
                        .navigate(R.id.action_SecondFragment_to_FirstFragment);
            }
        });
    }
 
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
 
}