forked from p30918427/pymxbt7cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
package com.example.start2;
|
|
|
|
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;
|
|
|
|
public class FirstFragment extends Fragment {
|
|
|
|
@Override
|
|
public View onCreateView(
|
|
LayoutInflater inflater, ViewGroup container,
|
|
Bundle savedInstanceState
|
|
) {
|
|
// Inflate the layout for this fragment
|
|
return inflater.inflate(R.layout.fragment_first, container, false);
|
|
}
|
|
|
|
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
|
super.onViewCreated(view, savedInstanceState);
|
|
|
|
view.findViewById(R.id.button_first).setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View view) {
|
|
NavHostFragment.findNavController(FirstFragment.this)
|
|
.navigate(R.id.action_FirstFragment_to_SecondFragment);
|
|
}
|
|
});
|
|
}
|
|
} |