Android: how to get notified when a widget is tapped
I would like to get a notification when the user taps/clicks on a widget?
Is there something similar开发者_JAVA百科 to onClick()?
You must use AppWidgetProvider
and register listeners there. Since in Widgets all view are created via RemoteViews
you must use methods on them - e.g. setOnClickPendingIntent()
.
Here is a small example: http://developer.android.com/guide/topics/appwidgets/index.html#AppWidgetProvider
精彩评论