title: How do I make my notification launch an activity when clicked?
body: <p>This is the code for my notification, which when clicked, opens <code>mainactivity</code> by default, but how do I change it? I want to open <code>SecondActivity</code> when it is clicked.</p>
  
  <pre><code>NotificationManager notificationManager = (NotificationManager) this
              .getSystemService(Context.NOTIFICATION_SERVICE);
      Notification noti = new Notification.Builder(this)
              .setAutoCancel(false)
              .setContentIntent(
                      PendingIntent.getActivity(this, 0, getIntent(),
                              PendingIntent.FLAG_UPDATE_CURRENT))
              .setContentTitle("X ADB").setContentText("client in running")
              .setOngoing(true).setSmallIcon(R.drawable.ic_launcher)
              .setTicker("ticker message")
              .setWhen(System.currentTimeMillis()).build();
      noti.flags |= Notification.FLAG_NO_CLEAR;
      notificationManager.notify(111, noti);
  </code></pre>