How to communicate between fragments?
问题 I am developing an Android application. I have a requirement like there is a button in fragment 1, when a user clicks that button result should be displayed in fragment 2. While loading the activity both fragments is attached. Here is my try: In main activity: public void dsp(String str) { secondfragment f2=new secondfragment(); Bundle bundle = new Bundle(); bundle.putString("edttext", "From Activity"); f2.setArguments(bundle); } In first fragment: public View onCreateView(LayoutInflater