What about something like that?
boolean updateIsRunning = false;
if (!updateIsRunning)
{
updateIsRunning = true;
//perform your update
updateIsRunning = false;
}
Question
I have a home screen widget and I have some trouble with it. I update my widget on click on the widget. A service starts, sets a message in the widget (Loading...) and updates the widget. It works correctly but if I click several times on the widget, the widget keeps in memory that I have clicked several times and it updates it several times when the previous click was treated.
Here is a sketch to really understand how it works (because my english is not as good as I wish): http://hpics.li/f3bcbaa
Thank you in advance for your help. If you need some code to understand what I would like to have, just ask me.
Solution
What about something like that?
boolean updateIsRunning = false;
if (!updateIsRunning)
{
updateIsRunning = true;
//perform your update
updateIsRunning = false;
}