PendingIntent works correctly for the first notification but incorrectly for the rest

Worked when added these:

  1. intent.setAction(Long.toString(System.currentTimeMillis()));

 

PackageManager pm = context.getPackageManager();

    Intent intent = new Intent(context, MyOwnActivity.class);
    intent.putExtra("foo_bar_extra_key", "foo_bar_extra_value");
    intent.setAction(Long.toString(System.currentTimeMillis()));
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
            intent, PendingIntent.FLAG_UPDATE_CURRENT);
    RemoteViews views = new RemoteViews(context.getPackageName(),
            R.layout.widget_layout);
    views.setOnClickPendingIntent(my_button_r_id_received_in_parameter, pendingIntent);

Delegate onClick C#

// Java code
     button.setOnClickListener (new View.OnClickListener() {
             public void onClick(View v) {
          button.setText ("Times clicked: " + Integer.toString(counter));
             }
         });
// C# code
     button.Click += delegate {
          button.Text = "Times clicked: " + counter;
     };