Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to know the position of notification in android
    primarykey
    data
    text
    <p>I am trying to display list of elements in notification bar. Now I have a set of notifications but every notification I am clicking takes me to same activity i.e. I was not able to store the position of notification.</p> <p>Here is my code</p> <pre><code> if (list != null &amp;&amp; !list.isEmpty()) { for (int i = 0; i &lt; list.size(); i++) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle( "Coupon Received From " + list.get(i).merchantName) .setContentText( "Coupon Value : " + list.get(i).couponValue) .setAutoCancel(true) .setTicker("Coupon alert message from Kluebook") .setVibrate(new long[] { 100, 250, 100, 250 }); Intent resultIntent = new Intent(context, CouponDetailActivity.class); resultIntent.putExtra("couponid", list.get(i).couponid); resultIntent.putExtra("position", list.get(i).i); resultIntent.putExtra("branchid", list.get(i).issuedBranchid); PendingIntent resultPendingIntent = PendingIntent.getActivity( context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotifyMgr = (NotificationManager) context .getSystemService(context.NOTIFICATION_SERVICE); mNotifyMgr.notify(i + 1, mBuilder.build()); } } else { System.out.println("+++++++++++ IT IS EMPTY +++++++++++++++ list"); } } </code></pre> <p>If I get 5 notifications in notification bar, every notification takes me to first notification activity.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload