Sendet
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.

SecondFragment.java 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.example.erdbebensender;
  2. import android.os.Bundle;
  3. import android.view.LayoutInflater;
  4. import android.view.View;
  5. import android.view.ViewGroup;
  6. import androidx.annotation.NonNull;
  7. import androidx.fragment.app.Fragment;
  8. import androidx.navigation.fragment.NavHostFragment;
  9. public class SecondFragment extends Fragment {
  10. @Override
  11. public View onCreateView(
  12. LayoutInflater inflater, ViewGroup container,
  13. Bundle savedInstanceState
  14. ) {
  15. // Inflate the layout for this fragment
  16. return inflater.inflate(R.layout.fragment_second, container, false);
  17. }
  18. public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
  19. super.onViewCreated(view, savedInstanceState);
  20. view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
  21. @Override
  22. public void onClick(View view) {
  23. NavHostFragment.findNavController(SecondFragment.this)
  24. .navigate(R.id.action_SecondFragment_to_FirstFragment);
  25. }
  26. });
  27. }
  28. }