The Activity transmits a value to another Activity. Fragment obtains the value in another Activity ., Activityfragment
Jump to MainActivity in oneActivity
// Intent is used to jump to another MainActivity, and bundle transfers the value to MainActivity
Intent MainActivity = new Intent ();
MainActivity. setClass (this, MainActivity. class );
Bundle bundle = new Bundle (); // This class is used to carry data
Bundle. putString ("user", user. getText (). toString ());
MainActivity. putExtras (bundle); // transmits a value to MainActivity
This. startActivity (MainActivity );
// Prevent crawling http://www.cnblogs.com/xiaobo-Linux/ qq463431476
You need to jump to Fragment in MainActivity,
Fragment:
// Receive the user value
Bundle bundle = getActivity (). getIntent (). getExtras ();
String user = bundle. getString ("user ");
According to personal research.