1

Android's RemoteView class provides the method setOnClickPendingIntent instead of setOnClickListener. What is the reason for this ? What's the advantage of using PendingIntent in this case ?

Bunny Rabbit
  • 8,213
  • 16
  • 66
  • 106
  • 4
    *iirc* A remote view is not running in your applications process, therefore it has to use IPC to tell your app something is clicked. This is asynchronous and so it is a "pending" click , not an instant click. The name reflects a subtle behaviour difference. – Blundell Oct 27 '14 at 12:01
  • @Blundell make your comment into an answer. – David Wasser Nov 03 '14 at 20:31

1 Answers1

2

iirc

A remote view is not running in your applications process, therefore it has to use IPC to tell your app something is clicked. This is asynchronous and so it is a "pending" click, not an instant click. The name reflects a subtle behaviour difference.

#setOnClickPendingIntent(int, android.app.PendingIntent)

vs

#setOnClickListener(android.view.View.OnClickListener)

Blundell
  • 75,855
  • 30
  • 208
  • 233
  • There must be some behaviour differences between Intent and PendingIntent, otherwise `setOnClickIntent(int, Intent)` would be good enough to satisfy the subtle naming, non? – ataulm Nov 04 '14 at 14:29
  • Yes but the question is not about `Intent` vs `PendingIntent` more about `onClick` from a `RemoteView` vs `onClick` from a `View` – Blundell Nov 04 '14 at 15:52