Kommineni Veeranayana
Kommineni Veeranayana

Reputation: 103

Android Widget animation for ImageView

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?

enter image description here

Upvotes: 2

Views: 1296

Answers (1)

Patrick R
Patrick R

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

Related Questions