Classic teaches that activity should not directly interact with fragment methods and variables. Only through interfaces. When studying this topic, I noticed that the transfer of data from the activity to the fragment, carried out through Bandle, refers directly to the field of the fragment in the activity. How does this fit the teaching?
@Override public void interface1(String string) { Fragment fragment = new Fragment2(); FragmentManager fm = getFragmentManager(); Bundle bundle = new Bundle(); bundle.putString(Fragment2.KEY, string); //Fragment2.KEY - поле фрагмента fragment.setArguments(bundle); fm.beginTransaction().add(R.id.fragmentContainer2, fragment).commit(); }