a、Activity1发送:    

Intent intent = new Intent();   
intent.setClass(activity1.this, activity2.class);   //描述起点和目标   
Bundle bundle = new Bundle();                           //创建Bundle对象   
bundle.putString("something", "Activity1发来的数据");     //装入数据   
intent.putExtras(bundle);                                //把Bundle塞入Intent里面   
startActivity(intent);                                     //开始切换 

 

b、Activity2接受从Activity1发来的数据:

Intent intent = this.getIntent();        //获取已有的intent对象   

相关文章:

  • 2022-12-23
  • 2021-11-07
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-12-18
猜你喜欢
  • 2021-09-01
  • 2021-06-13
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案