1

Android的RemoteView类提供了方法setOnClickPendingIntent而不是setOnClickListener。这是什么原因?在这种情况下使用PendingIntent有什么好处?为什么Android RemoteView类仅提供setOnClickPendingIntent

+3

* IIRC *远程查看是不是在你的应用程序的进程中运行,因此必须使用IPC来告诉你的应用程序的东西被点击。这是异步的,因此它是“待处理”点击,而不是即时点击。这个名字反映了一种微妙的行为差异。 – Blundell 2014-10-27 12:01:58

+0

@Blundell让你的评论成为一个答案。 – 2014-11-03 20:31:29

回答

0

IIRC

远程视图没有在您的应用程序的进程中运行,因此必须使用IPC告诉你的应用程序的东西被点击。这是异步的,因此它是“待处理”点击,而不是即时点击。这个名字反映了一种微妙的行为差异。

#setOnClickPendingIntent(int, android.app.PendingIntent)

VS

#setOnClickListener(android.view.View.OnClickListener)

+0

Intent和PendingIntent之间必须存在一些行为差异,否则'setOnClickIntent(int,Intent)'会足以满足微妙的命名,非? – ataulm 2014-11-04 14:29:29

+0

是的,但问题不是关于''Intent' vs'PendingIntent'关于'RemoteView'的'onClick'和''View''的'onClick'更多的问题 – Blundell 2014-11-04 15:52:48