1#
原文:http://blog.cfxixi.com/post/2012/10/23/Android%E5%A6%82%E4%BD%95%E5%AE%9A%E4%B9%89Notification%E7%9A%84%E7%82%B9%E5%87%BB%E6%89%93%E5%BC%80%E9%A1%B5%E9%9D%A2.aspx
如果希望弹出MainActivity.class对应的页面可以定义下列代码:

Intent m_Intent;

m_Intent = new Intent(MainActivity.this, MainActivity.class);

m_PendingIntent = PendingIntent.getActivity(MainActivity.this, 0, m_Intent, 0);
如果是希望弹出MainActivity2,class对应的页面

Intent m_Intent;

m_Intent = new Intent(MainActivity.this, MainActivity2.class);

m_PendingIntent = PendingIntent.getActivity(MainActivity.this, 0, m_Intent, 0);



附弹出的代码
  1. m_Notification.icon = R.drawable.img1;

  2.                         //�����ǵ��֪ͨʱ��ʾ������

  3.                         m_Notification.tickerText = message.getBody();

  4.                         //֪ͨʱ����Ĭ�ϵ�����

  5.                         m_Notification.defaults = Notification.DEFAULT_SOUND;



  6.                         m_Notification.setLatestEventInfo(MainActivity.this, fromName, message.getBody(), m_PendingIntent);



  7.                         m_NotificationManager.notify(0, m_Notification);

复制代码