Home > Mobile >  Intent. PutExtra method to transfer data
Intent. PutExtra method to transfer data

Time:10-07

After clicking the Button in FirstActivity jump to SecondActivity, and will be a string,
1. FirstActivity in sending code is as follows:

Intent Intent=new Intent (FirstActivity. This, SecondActivity. Class);
String data="https://bbs.csdn.net/topics/second activity";
Intent. PutExtra (" extra_data ", data);
startActivity(intent);
2. SecondActivity, in the onCreate () method, receiving code is as follows:

Intent Intent=getIntent ();
String data=https://bbs.csdn.net/topics/intent.getStringExtra (" extra_data ");

CodePudding user response:

There should be no mistake, it is an error? Or pass is not in the past?
  • Related