Android 的notification 的intent 传值

来源:互联网 发布:三国群英传8武将数据 编辑:程序博客网 时间:2024/04/30 13:36
notification用Intent传值的时候如果收不到,可以用bundle来传。
   
发送notify:
Intent intent=new Intent(this,MainActivity.class);Bundle bundle=new Bundle();bundle.putString("lvbo","result");intent.putExtras(bundle);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);


onNewIntent接收
@Overrideprotected void onNewIntent(Intent intent) {    super.onNewIntent(intent);
String result=getIntent().getExtras().getString("lvbo");
}


0 0
原创粉丝点击