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 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package com.example.ueberwachungssystem.Fragments;
  2. import android.content.Context;
  3. import android.os.Bundle;
  4. import android.util.Log;
  5. import android.view.LayoutInflater;
  6. import android.view.View;
  7. import android.view.ViewGroup;
  8. import android.widget.ImageView;
  9. import androidx.fragment.app.Fragment;
  10. import com.example.ueberwachungssystem.R;
  11. public class Fragment3 extends Fragment {
  12. private OnImageViewReadyListener onImageViewReadyListener;
  13. private String text;
  14. public static ImageView ivp;
  15. private final static String KEY_TEXT = "KEY_TEXT";
  16. private void log(String nachricht) {
  17. Log.d(this.getClass().getSimpleName(), nachricht);
  18. }
  19. @Override
  20. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
  21. log("onCreateView");
  22. View view = inflater.inflate(R.layout.fragment3, container, false);
  23. if (onImageViewReadyListener != null) {
  24. ImageView ivp = (ImageView) view.findViewById(R.id.Video);
  25. ImageView ivp2 = (ImageView) view.findViewById(R.id.Video2);
  26. onImageViewReadyListener.onImageViewReady(ivp, ivp2);
  27. }
  28. return view;
  29. }
  30. public static Fragment3 erstellen(View view) {
  31. Fragment3 fragment = new Fragment3();
  32. return fragment;
  33. }
  34. public interface OnImageViewReadyListener {
  35. void onImageViewReady(ImageView imageView, ImageView imageView2);
  36. }
  37. public void onAttach(Context context) {
  38. super.onAttach(context);
  39. try {
  40. onImageViewReadyListener = (OnImageViewReadyListener) context;
  41. } catch (ClassCastException e) {
  42. throw new ClassCastException(context.toString() + " must implement OnImageViewReadyListener");
  43. }
  44. }
  45. @Override
  46. public void onCreate(Bundle bundle) {
  47. super.onCreate(bundle);
  48. Bundle args = getArguments();
  49. if (args != null ) {
  50. text = args.getString(KEY_TEXT);
  51. log("onCreate: text=" + text);
  52. } else {
  53. log("onCreate");
  54. }
  55. }
  56. }