我試圖從tabview(那些花費大約1/3的小屏幕)切換到可通過通知消息選擇的全屏。Android通知消息(不)從活動切換
到目前爲止,一切都按照許多howto的指示完成,它的所有工作都像魅力一樣。 (這是在SDK模擬器)
現在我已經將應用程序轉移到我的實際Android手機,現在它不再通過通知切換屏幕了。它總是打開MainActivity。
private void DroiDCNotification(int NotificationID, CharSequence tickerText, CharSequence contentTitle, CharSequence contentText) {
//throw new UnsupportedOperationException("Not yet implemented");
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.droidc_icon; // icon from resources
long when = System.currentTimeMillis(); // notification time
Context context = getApplicationContext(); // application Context
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
// the next two lines initialize the Notification, using the configurations above
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NotificationID, notification);
}
那麼我怎樣才能使通知調用特定的活動打開指定的活動?
謝謝,實際上聽起來很邏輯。 – Johan 2010-12-23 21:38:13