創建多個狀態欄通知我需要創建多個狀態欄通知。當我拉下狀態欄時,多個通知圖標應顯示爲列表。每個通知圖標應顯示單獨的數據以顯示在下一頁上。我可以如何做到這一點?如何在android系統
我的代碼:
public class SimpleNotification extends Activity {
private NotificationManager mNotificationManager;
private int SIMPLE_NOTFICATION_ID;
String str="Hai";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification notifyDetails = new Notification(R.drawable.android,"New Alert, Click Me!",System.currentTimeMillis());
Button start = (Button)findViewById(R.id.notifyButton);
Button cancel = (Button)findViewById(R.id.cancelButton);
start.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Context context = getApplicationContext();
CharSequence contentTitle = "Notification Details...";
CharSequence contentText = "Browse Android Official Site by clicking me";
Intent notifyIntent = new Intent(SimpleNotification.this,
sub.class);
Bundle bundle = new Bundle();
bundle.putString("welcome",str);
notifyIntent.putExtras(bundle);
PendingIntent intent =
PendingIntent.getActivity(SimpleNotification.this, 0,
notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
}
});
在這裏,我做了一個通知,但我需要創建多個通知,每個通知應該顯示的每個數據。
可能的[多個通知,重複相同的活動](http://stackoverflow.com/questions/6066363/multiple-notifications-to-the-same-activity) – 2016-03-08 07:24:38