2016-05-16 64 views
-1

如何通過掛起的意圖打開確切的消息會話,當我們與點擊通知的消息,像傳遞線程ID和看如何通過傳遞線程ID未決的意圖

PendingIntent nPendingInten = PendingIntent.getActivity(context, 0, nIntent, 
          PendingIntent.FLAG_UPDATE_CURRENT); 
    Intent intent = new Intent(context, ConvActivity.class); 
        intent.putExtra(ConvActivity.THREAD_ID_EXTRA, threadId); 
        intent.putExtra(ConvActivity.THREAD_NAME_EXTRA,listItem.getContactName()); 
        intent.putExtra(ConvActivity.THREAD_IMAGE_EXTRA, uri); 
        intent.putExtra(ConvActivity.THREAD_NUM_EXTRA,listItem.getAddress()); 
+3

那麼是什麼問題? –

+0

那麼你有什麼問題? – pskink

回答

0

你逝去的另一個意圖談話您的未決意圖 - 請注意。

Intent intent = new Intent(context, ConvActivity.class); 
        intent.putExtra(ConvActivity.THREAD_ID_EXTRA, threadId); 
        intent.putExtra(ConvActivity.THREAD_NAME_EXTRA,listItem.getContactName()); 
        intent.putExtra(ConvActivity.THREAD_IMAGE_EXTRA, uri); 
        intent.putExtra(ConvActivity.THREAD_NUM_EXTRA,listItem.getAddress()); 
    PendingIntent nPendingInten = PendingIntent.getActivity(context, 0, intent, 
           PendingIntent.FLAG_UPDATE_CURRENT); 
0

試試這個代碼

PendingIntent nPendingInten = PendingIntent.getActivity(context, 0, nIntent, 
         PendingIntent.FLAG_UPDATE_CURRENT); 
Intent intent = new Intent(context, ConvActivity.class); 
       intent.putExtra(ConvActivity.THREAD_ID_EXTRA,  

threadId.longvalue);// change here 
       intent.putExtra(ConvActivity.THREAD_NAME_EXTRA,listItem.getContactName()); 
       intent.putExtra(ConvActivity.THREAD_IMAGE_EXTRA, uri); 
       intent.putExtra(ConvActivity.THREAD_NUM_EXTRA,listItem.getAddress());