package com.example.ueberwachungssystem.Fragments; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.VideoView; import androidx.fragment.app.Fragment; import com.example.ueberwachungssystem.R; import java.io.File; public class Fragment1 extends Fragment { private String text; private final static String KEY_TEXT = "KEY_TEXT"; private void log(String nachricht) { Log.d(this.getClass().getSimpleName(), nachricht); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { log("onCreateView"); View view = inflater.inflate(R.layout.fragment1, container, false); TextView Sensor = (TextView) view.findViewById(R.id.Alarm); Sensor.setText(text); return view; } public static Fragment1 erstellen(String text) { Fragment1 fragment = new Fragment1(); Bundle b = new Bundle(); b.putString(KEY_TEXT, text); fragment.setArguments(b); return fragment; } public static Fragment1 aktualisieren(String text){ Fragment1 fragment = new Fragment1(); Bundle b = new Bundle(); b.putString(KEY_TEXT, text); fragment.setArguments(b); return fragment; } @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); Bundle args = getArguments(); if (args != null ) { text = args.getString(KEY_TEXT); log("onCreate: text=" + text); } else { log("onCreate"); } } }