Reputation: 103
I have one Widget with сouple of TextViews
and one ImageView
. Whenever user click on the ImageView
I am refreshing widget data in the background. This process takes some time. Meanwhile, I want to show small custom animated loader in the ImageView
place.
For ImageView
click I use the following statement on the widget:
Views.setOnClickPendingIntent(R.id.ImageView, loadIntent);
Could anyone guide me how to implement this functionality?
Upvotes: 2
Views: 1296
Reputation: 6857
Take one progress bar in your widget layout
When you receive click event of your refresh button make progress bar's visibility to visible:
views.setViewVisibility(R.id.img_refresh, View.GONE);
views.setViewVisibility(R.id.pb_widget, View.VISIBLE);
After your process complete for refreshing data make image visible and progress bar to gone:
views.setViewVisibility(R.id.img_refresh, View.VISIBLE);
views.setViewVisibility(R.id.pb_widget, View.GONE);
Upvotes: 5