I am a beginner, and would be very grateful if anyone could help me out here.
I have read the android documentation guide and reference about some classes here, but I am not able to understand exactly what is happening.
I have mentioned my queries as comments in the code and then finally together.
In the android documentation, while creating a simple notification, this is the code they use:
NotificationCompat.Builder mBuilder =
    new NotificationCompat.Builder(this)
    .setSmallIcon(R.drawable.notification_icon)
    .setContentTitle("My notification")
    .setContentText("Hello World!");
// We created an intent here!
Intent resultIntent = new Intent(this, ResultActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
// Now, what are we exactly doing below line... I don't understand the concept of parentStack
stackBuilder.addParentStack(ResultActivity.class);
// What is 'addNextIntent' exactly doing? I mean, there is only one intent right? What is this "Next" Intent?
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
    stackBuilder.getPendingIntent(
        0,
        PendingIntent.FLAG_UPDATE_CURRENT
    );
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(mId, mBuilder.build());
 
     
    