Gruppe 1
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.

Fragment3.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.example.ueberwachungssystem.Fragments;
  2. import android.os.Bundle;
  3. import android.util.Log;
  4. import android.view.LayoutInflater;
  5. import android.view.View;
  6. import android.view.ViewGroup;
  7. import android.widget.TextView;
  8. import androidx.fragment.app.Fragment;
  9. import com.example.ueberwachungssystem.R;
  10. public class Fragment3 extends Fragment {
  11. private String text;
  12. private final static String KEY_TEXT = "KEY_TEXT" ;
  13. private void log(String nachricht) {
  14. Log.d(this.getClass().getSimpleName(), nachricht);
  15. }
  16. @Override
  17. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
  18. log( "onCreateView" );
  19. View view = inflater.inflate(R.layout.fragment2, container, false );
  20. TextView Sensor = (TextView) view.findViewById(R.id.Sensor);
  21. Sensor.setText(text);
  22. return view;
  23. }
  24. public static Fragment3 erstellen(String text) {
  25. Fragment3 fragment = new Fragment3();
  26. Bundle b = new Bundle();
  27. b.putString(KEY_TEXT, text);
  28. fragment.setArguments(b);
  29. return fragment;
  30. }
  31. @Override
  32. public void onCreate(Bundle bundle) {
  33. super.onCreate(bundle);
  34. Bundle args = getArguments();
  35. if (args != null) {
  36. text = args.getString(KEY_TEXT);
  37. log("onCreate: text=" + text);
  38. } else {
  39. log("onCreate");
  40. }
  41. }
  42. }