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.

Fragment1.java 1.8KB

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