2015-08-13 69 views
1

我有通知,點擊它,我需要去MainActivity頁面輸入密碼和登錄,然後去ItemDetail活動page.But雖然發送通知我有一些額外的,我需要傳遞給ItemDetail Activity頁面,我將如何從點擊發送到ItemActivity,因爲我有MainActivity之間?通過登錄發送通知clcik的額外

private void sendNotification(String msg, int invM_id, int prmR_id) { 

     try { 
     Intent notificationIntent = new Intent(this, ItemActivity.class); 
     notificationIntent.setAction(Intent.ACTION_MAIN); 
     notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER); 
     data1=WebService.InvoiceDetailForExeedDiscount1(invM_id); 
***//I need these data in ItemActvity,i can read this before introducing MainActivity in between*** 
     notificationIntent.putExtra("invoiceList", data1); 
     notificationIntent.putExtra("notified","yes"); 
     notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); 
     PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); 

     mNotificationManager = (NotificationManager) 
       this.getSystemService(Context.NOTIFICATION_SERVICE); 

     NotificationCompat.Builder mBuilder = 
       new NotificationCompat.Builder(this) 
     .setSmallIcon(R.drawable.ic_launcher) 
     .setContentTitle(getString(R.string.invoice_alert)) 
     .setStyle(new NotificationCompat.BigTextStyle() 
     .bigText(msg)) 
     .setContentText(msg); 
      reminderStrings.append(prmR_id); 
      reminderStrings.append(","); 

     mBuilder.setContentIntent(contentIntent); 
     mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); 
     NOTIFICATION_ID++; 

     } 

回答

0

你不能做雙重過關。您必須分兩步進行,例如將所有信息傳遞給MainActivity,然後可能在MainActivity內部,在完成該表單後檢查是否有該信息,如果有,則將其傳遞給ItemActivity

+0

其他走 ?像任何可用的方法? – jenil

+0

恐怕你需要開始其他活動,如果你需要它的信息 – Ben

+0

嗯讓我嘗試一下工作n更新這裏 – jenil