2011-06-17 34 views
0

我正在這樣做來創建一個意圖。android:從意圖額外獲得相同的值

Intent notificationIntent = new Intent(this, Startup.class); 
notificationIntent.putExtra("url", contentUrl); 

PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); 
Notification notification = new Notification(icon, tickerText, when); 
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 

在獲得額外的,

CharSequence url = this.getIntent().getCharSequenceExtra("url"); 

有很多意圖各自的URL值。但是我也會在Startup類的onCreate()中獲得相同的值。

我做錯了什麼?

+0

是這些都不同的活動.. – ngesh 2011-06-17 10:42:31

+0

對不起,我不通過不同的活動,瞭解.. – anewbie 2011-06-17 10:49:38

回答

0

使用此

的PendingIntent contentIntent = PendingIntent.getActivity(此,0, notifyIntent,android.content.Intent.FLAG_ACTIVITY_NEW_TASK );

代替這種

的PendingIntent contentIntent = PendingIntent.getActivity(上下文,0,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);

並檢查結果