problem description
after the native class jumps to the RN class, the Intent object is null
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
Native classes
public class MainActivity extends Activity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
}
public void onClick(View v){
Intent in=new Intent(this,SecondActivity.class);
in.putExtra("name","Test");
in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(in);
}
}
inherits ReactActivity"s class
public class SecondActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
String str = "Test";
Intent intent = getIntent();
if (intent != null) {
str = intent.getStringExtra("name");
Log.e("SecondActivity", "SecondActivity" + str);
}
return str;
}
}