且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

android 广播传参数

更新时间:2022-09-07 22:43:59

引用:http://www.189works.com/article-30243-1.html

发送代码:
  1. Intent intent = new Intent(...);  
  2. Bundle bundle = new Bundle();  
  3. bundle.putString("param""value");  
  4. intent.putExtras(bundle);  
  5. context.startActivity(intent); 或 context.startService(intent);  
 
接收代码:
  1. Bundle bunde = intent.getExtras();  
  2. String name = bunde.getInt("param");