I'm developing on Android. I have to restart home and all its components (widgets, shortcuts, etc..). For example, when we have a Force Close, the home screen restart and reload all its components.
+2
A:
I have to restart home and all its components (widgets, shortcuts, etc..).
No, you don't.
For example, when we have a Force Close, the home screen restart and reload all its components.
If you have a "Force Close", you cannot execute code. Hence, what you want is impossible.
CommonsWare
2010-08-30 08:00:37
My problem is that some widgets doesn't refresh its state.Only method to do this is restart home.
Cecco
2010-08-30 08:10:19
@Cecco: You are welcome to update your app widgets whenever you want via an `AppWidgetManager`. You do not need to attack the user by trying to kill the HOME screen.
CommonsWare
2010-08-30 08:21:10
@Cecco: Listen to CW. In your widget, you can set android:updatePeriodMillis to tell it how often to update. Note that with, I believe Android 1.6, the minimum update time is 1800 (or 30 minutes).
kcoppock
2010-08-30 14:12:12
You don't even need to wait that long. You can update your app widget *anytime*. Just fill in the `RemoteViews` and pass it to an `AppWidgetManager` you get from `getInstance()`.
CommonsWare
2010-08-30 15:00:29