I want when the user click on the notification it return to the app or start a new activity , I tried all the codes here but it close my application suddenly . if anyone can help me to modify my code below I will be grateful . Thank u .
        Calendar calendar = Calendar.getInstance();
    Intent intent;
    PendingIntent pendingIntent;
    AlarmManager alarmManager;
    long futureInMillis;
    // SharedPreferences sharedPreferences = null;
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    int uniqueCode = preferences.getInt("uniqueCode", 0) + 1;
    preferences.edit().putInt("uniqueCode", uniqueCode).apply();
    calendar.set(Calendar.YEAR, year);
    calendar.set(Calendar.MONTH, month); // January has value 0
    calendar.set(Calendar.DAY_OF_MONTH, day);
    calendar.set(Calendar.HOUR_OF_DAY, hour);
    calendar.set(Calendar.MINUTE, min);
    calendar.set(Calendar.SECOND, 0);
    //calendar.set(Calendar.AM_PM, Calendar.AM );
    //futureInMillis = calendar.getTimeInMillis();
    //futureInMillis = SystemClock.elapsedRealtime() + (value * 1000);
    intent = new Intent(getActivity(), NotificationReceiver.class);
    intent.putExtra(NotificationReceiver.NOTIFICATION_ID, 1);
    intent.putExtra(NotificationReceiver.NOTIFICATION, getNotification(" "+taskn+" moved to q1 "));
    pendingIntent = PendingIntent.getBroadcast(getActivity(), uniqueCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
    return rootView;
}
private Notification getNotification(String content) {
Notification.Builder builder = new Notification.Builder(getActivity());
    query.whereEqualTo("TaskN",taskn);
    query.whereEqualTo("TheUser", username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject object, com.parse.ParseException e) {
            object.put("Quadric", "q1");
            object.saveInBackground();
        }
    });
    builder.setContentTitle("Time management.");
    builder.setContentText(content);
   // notification.setLatestEventInfo(context, title, text, contentIntent);
    // builder.setSound();
    builder.setSmallIcon(R.drawable.ic_home);
   return builder.build();
}
i get this in logCat :
    04-02 13:42:24.161    4030-4030/info.androidhive.slidingmenu E/OpenGLRenderer﹕       Getting MAX_TEXTURE_SIZE from GradienCache
04-02 13:42:24.161    4030-4030/info.androidhive.slidingmenu E/OpenGLRenderer﹕       MAX_TEXTURE_SIZE: 16384
04-02 13:42:24.173    4030-4030/info.androidhive.slidingmenu E/OpenGLRenderer﹕       Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-02 13:42:24.185    4030-4030/info.androidhive.slidingmenu E/OpenGLRenderer﹕      MAX_TEXTURE_SIZE: 16384
04-02 13:49:50.309    4118-4118/info.androidhive.slidingmenu E/TaskStackBuilder﹕      Bad ComponentName while traversing activity parent metadata
04-02 13:49:50.309    4118-4118/info.androidhive.slidingmenu E/AndroidRuntime﹕       FATAL EXCEPTION: main
Process: info.androidhive.slidingmenu, PID: 4118
java.lang.IllegalArgumentException:            android.content.pm.PackageManager$NameNotFoundException:     ComponentInfo{info.androidhive.slidingmenu/info.androidhive.slidingmenu.NotificationActivity}
        at android.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:180)
        at android.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:151)
        at info.androidhive.slidingmenu.NotificationFragment.onCreateView(NotificationFragment.java:80)
        at android.app.Fragment.performCreateView(Fragment.java:1700)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
        at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
        at android.app.BackStackRecord.run(BackStackRecord.java:684)
        at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
        at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5001)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)
   Caused by: android.content.pm.PackageManager$NameNotFoundException: ComponentInfo{info.androidhive.slidingmenu/           info.androidhive.slidingmenu.NotificationActivity}
            at android.app.ApplicationPackageManager.getActivityInfo(ApplicationPackageManager.java:242)
            at android.app.TaskStackBuilder.addParentStack(TaskStackBuilder.java:167)
when i try this code :
     intent = new Intent(getActivity(), NotificationReceiver.class);
    intent.putExtra(NotificationReceiver.NOTIFICATION_ID, 1);
    intent.putExtra(NotificationReceiver.NOTIFICATION, getNotification(" "+taskn+" moved to q1 "));
    pendingIntent = PendingIntent.getBroadcast(getActivity(), uniqueCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    alarmManager = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(getActivity());
    // Adds the back stack for the Intent (but not the Intent itself)
    stackBuilder.addParentStack(NotificationActivity.class);
    // Adds the Intent that starts the Activity to the top of the stack
    stackBuilder.addNextIntent(intent);
    pendingIntent = stackBuilder
            .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT
                    | PendingIntent.FLAG_ONE_SHOT);
  private Notification getNotification(String content) {
Notification.Builder builder = new Notification.Builder(getActivity());
    query.whereEqualTo("TaskN",taskn);
    query.whereEqualTo("TheUser", username);
    query.getFirstInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject object, com.parse.ParseException e) {
            object.put("Quadric", "q1");
            object.saveInBackground();
        }
    });
    builder.setContentTitle("Time management.");
    builder.setContentText(content);
   // notification.setLatestEventInfo(context, title, text, contentIntent);
    // builder.setSound();
    builder.setSmallIcon(R.drawable.ic_home);
   return builder.build();
}
 
    