android中如何点击通知定位到指定的activity
private void initNotification() {mState = STATE_EXITED;mHungup = mContext.getResources().getString(R.string.hungup);mPlaying = mContext.getResources().getString(R.string.signalPrompt);if (null == mNM) {mNM = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);}if (null == mNotification) {mNotification = new Notification();mNotification.flags = Notification.FLAG_NO_CLEAR;}setRemoteActivity(LAUNCHER);setContentView();}/* * set the activity to go when click the item in the notification area. */public void setRemoteActivity(String launcher) {ComponentName comp = new ComponentName(PKGNAME, PKGNAME + launcher);Intent notificationIntent = new Intent();notificationIntent.setComponent(comp);if (launcher.equals(LAUNCHER)) {notificationIntent.addCategory("android.intent.category.LAUNCHER");notificationIntent.setAction("android.intent.action.MAIN");notificationIntent.setFlags(0x10200000);} else {notificationIntent.putExtra(Define.INTENT_CHANNEL_POSITION,MBBMSService.sCurrentPlayPosition);notificationIntent.setAction(Action.ACTION_VIEW_PROGRAM_ACTION);}mNotification.contentIntent = PendingIntent.getActivity(mContext, 0,notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);}private void setContentView() {mContentView = new RemoteViews(mContext.getPackageName(),R.layout.status_bar_signal);mContentView.setTextViewText(R.id.text, mPlaying);mContentView.setImageViewResource(R.id.icon, R.drawable.icon_tvplayer);mNotification.contentView = mContentView;}?? ?方法setRemoteActivity里面使得后台运行的应用显示到主界面上,同时使得最后一次运行的activity显示在activity堆栈的最上面