Search code examples
androidandroid-listviewandroid-appwidgetandroid-remoteview

Set onClickListener on EmptyView in RemoteViews


I make appWidget with listView. For this I need use RemoteViews. And when I init appWidget ListView I set adapter and empty view (when no content):

remoteViews.setEmptyView(R.id.listViewWidget, R.id.empty_view);

But my emptyView contains button, and I need to set OnClickListener for it. How I can do that?


Solution

  • You would need setOnClickPendingIntent.

    remoteviews.setOnClickPendingIntent(button_id, pendingIntent);
    

    More Info