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)引用此答案| 舉報

相關文章
相關標籤/搜索