0
我已经创建了一个状态栏通知,该状态栏通知在状态栏上给了我一些消息,当点击该消息重定向到全新的布局时。 状态栏的代码 -从状态栏打开的活动没有完成
NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(this, TaskCompleteActivity.class);
notificationIntent.putExtra(TasksDBAdapter.KEY_ROWID, rowId);
notificationIntent.putExtra(TasksDBAdapter.KEY_TITLE, taskTitle);
notificationIntent.putExtra(TasksDBAdapter.KEY_BODY, taskDesc);
//notificationIntent.putExtra("NotificationId",);
Log.i(TAG,"rowId in doReminderWork" + rowId);
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent,PendingIntent.FLAG_ONE_SHOT);
Notification note=new Notification(android.R.drawable.stat_sys_warning,taskDesc,System.currentTimeMillis());
note.setLatestEventInfo(this, taskTitle,taskDesc, pi);
note.defaults |= Notification.FLAG_AUTO_CANCEL;
note.defaults |= Notification.DEFAULT_SOUND;
note.defaults |= Notification.DEFAULT_VIBRATE;
// you need to clear the notification on click of status bar notification //
note.flags |= Notification.FLAG_NO_CLEAR;
// An issue could occur if user ever enters over 2,147,483,647 tasks. (Max int
// value).
// I highly doubt this will ever happen. But is good to note.
int id = (int)((long)rowId);
mgr.notify(id, note);
这种布局是具有呼吁点击完成,其中我在数据库中的一行,并调用完成按钮()。代码 -
public void completeTask(){
taskDBAdapter.deleteReminder(rowId);
this.finish();
}
在此之后,如果我从正常的菜单中打开我的应用程序,它仍然显示我有完整的按钮,而不是我的目标活动此相同的布局。为什么这个活动没有完成?
由于事先 考希克
您可能需要发布一些更多的代码。从这两个陈述中很难看到发生了什么。 –
请留下余地,让我知道是否需要更多的细节 – RayKaushik