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 ?

2
  • 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, 2014 at 12:01
  • @Blundell make your comment into an answer. Nov 3, 2014 at 20:31

1 Answer 1

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)

2
  • 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 4, 2014 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 4, 2014 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.