public void showsrstatus() {
SrNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification srnotification = new Notification();
srnotification.icon = R.drawable.ic_launcher_soundrecorder;
srnotification.tickerText = "Soundrecorder";
srnotification.when = System.currentTimeMillis();
srnotification.flags = srnotification.FLAG_ONGOING_EVENT;
Intent intent = new Intent(SoundRecorder.this, SoundRecorder.class);
PendingIntent pi = PendingIntent.getActivity(SoundRecorder.this, 0,
intent, 0); // 消息触发后调用
srnotification.setLatestEventInfo(SoundRecorder.this, " "
+ getResources().getString(R.string.app_name), getResources()
.getString(R.string.record_your_message), pi);
SrNotificationManager.notify(SR_NOTIFI_ID, srnotification);
}
public void closesrstatus() {
SrNotificationManager.cancel(SR_NOTIFI_ID);
}
如果只想唤起一个activity , 则要在manifest里
设置 android:launchMode="singleTask"