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 ?
-
4iirc 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.– BlundellOct 27, 2014 at 12:01
-
@Blundell make your comment into an answer.– David WasserNov 3, 2014 at 20:31
1 Answer
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
-
There must be some behaviour differences between Intent and PendingIntent, otherwise
setOnClickIntent(int, Intent)
would be good enough to satisfy the subtle naming, non?– ataulmNov 4, 2014 at 14:29 -
Yes but the question is not about
Intent
vsPendingIntent
more aboutonClick
from aRemoteView
vsonClick
from aView
– BlundellNov 4, 2014 at 15:52