我有以下代码... 随着通知的到来... 它总是显示"1" 并且不计是否还有通知... 我做错了什么?
我要去读代码的起源是:
public class ActionSendSMS extends Activity {
private static final int NOTIFY_ME_ID=5476;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.actionsendsms);
givenotification(getBaseContext());
finish();
}
.... ....
public void givenotification(Context context){
//Get the notification manager
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager nm = (NotificationManager)context.getSystemService(ns);
//Create Notification Object
int count=1;
int icon = R.drawable.red_ball;
CharSequence tickerText = "Nice message!";
long when = System.currentTimeMillis();
final Notification notify = new Notification(icon, tickerText, when);
notify.flags |= Notification.DEFAULT_SOUND;
notify.flags |= Notification.FLAG_ONLY_ALERT_ONCE;
notify.flags |= Notification.FLAG_AUTO_CANCEL;
notify.number += count;
//Set Notification send options
Intent intent = new Intent(context, ActionNotifySendMessage.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
notify.setLatestEventInfo(context, "Message Alert", tickerText, pi);
nm.notify(NOTIFY_ME_ID, notify);
}