activity跳转到另一个activity
https://blog.csdn.net/jiayu0855/article/details/78759471
Intent intent=new Intent(MainActivity.this, SecondActivity.class); startActivity(intent);```
activity之间传递消息
https://blog.csdn.net/blueair_ren/article/details/52818778
1,intent
@1通过Intent向下一个活动发送数据。
String data = "nihao"; Intent intent = new Intent(activity1.this,activity2.class);
intent.putExtra("send_data",data);
startActivity(intent);
@2通过intent接收来自上一个活动的数据。
Intent intent = getIntent();
String data = intent.getStringExtra("send_data");
2.bundle
第一个activity
Intent intent=new Intent(MainActivity.this, SecondActivity.class);
Bundle bundle = new Bundle();
bundle.putString("aa","ddkkddk");
intent.putExtras(bundle);
startActivity(intent);
第二个activity
final Intent intent = getIntent();
Bundle bundle = intent.getExtras();
Log.e("leo", "onCreate: " + bundle.getString("aa"));
3.activity 与 fragment通信
Bundle bundle = new Bundle();
bundle.putString("message","我喜欢享学课堂");
BlankFragment1 bf = new BlankFragment1();
bf.setArguments(bundle);
replacefragment(bf);
Bundle bundle=this.getArguments();
Log.e("leo", "onCreate: "+ bundle.getString("message"));