Android中Notification值传到Activity获取不到

1.在Notification里面定义一个值android

           Intent intent = new Intent(MainActivity.this, NotifyActivity.class);this

            PendingIntent pi = PendingIntent.getActivity(MainActivity.this, 0, intent, 0); 

            Bundle bundle = new Bundle(); 
            bundle.putString("id","123456"); 
            intent.putExtras(bundle); 

            Notification notify = new Notification(); 
            notify.icon = R.drawable.ico_dog; 
            notify.tickerText = title; 
            notify.when = System.currentTimeMillis(); 
            notify.defaults = Notification.DEFAULT_SOUND; 
            notify.setLatestEventInfo(MainActivity.this, "最新通知", title, pi); 
            notify.vibrate = new long[]{0, 50, 100, 150}; 
            notify.contentIntent = pi; 
            notify.flags = Notification.FLAG_AUTO_CANCEL; 
            NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
spa

            nm.notify(0x1123, notify);.net


NotifyActivity里面这样写获取的id的值为NULL 是为何orm

         Intent intent = getIntent();
        Bundle data = intent.getExtras();
        String id  = data.getString("id");
排序

求解!!!!!!!!get


      


zileizilei
发帖于 1年前
2回/1517阅
it

标签: Androidio

0收藏(0)

按票数排序  显示最新答案  共有2个答案 (最后回答: 1年前)

    0

  • 平凡简单平凡简单1年前

    改为

     Intent intent = new Intent(MainActivity.this, NotifyActivity.class);

     Bundle bundle = new Bundle(); 
                bundle.putString("id","123456"); 
                intent.putExtras(bundle); 

                PendingIntent pi = PendingIntent.getActivity(MainActivity.this, 0, intent, 0); 


               

    评论(0)引用此答案| 举报

  • 0

  • zileizilei1年前

    嗯 已经解决 

    评论(0)引用此答案| 举报

相关文章
相关标签/搜索