12345678910111213141516171819202122232425262728293031323334 |
- package com.example.erdbebensender;
-
- 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 SecondFragment extends Fragment {
-
- @Override
- public View onCreateView(
- LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState
- ) {
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_second, container, false);
- }
-
- public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- NavHostFragment.findNavController(SecondFragment.this)
- .navigate(R.id.action_SecondFragment_to_FirstFragment);
- }
- });
- }
- }
|