में एकाधिक स्टेटसबार नोटिफिकेशन कैसे बनाएं I एकाधिक स्टेटसबार नोटिफिकेशन बनाने की आवश्यकता है। जब मैं स्टेटसबार खींचता हूं, तो एक अधिसूचना आइकन को सूची के रूप में प्रदर्शित किया जाना चाहिए। प्रत्येक अधिसूचना आइकन को अगले पृष्ठ पर प्रदर्शित करने के लिए अलग डेटा दिखाना चाहिए। मैं यह कैसे कर सकता हूं?एंड्रॉइड
मेरे कोड:
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) –