catch exceptions in widget update service
This commit is contained in:
parent
390eee760c
commit
aa64bbcb13
@ -46,12 +46,13 @@ public class WidgetUpdateService extends Service {
|
||||
public void onStart(Intent intent, int startId) {
|
||||
final RemoteViews view = new RemoteViews(getPackageName(), R.layout.widget_small);
|
||||
|
||||
view.setTextViewText(R.id.counter, String.valueOf(""));
|
||||
view.setViewVisibility(R.id.progress, View.VISIBLE);
|
||||
|
||||
final ComponentName thisWidget = new ComponentName(this, SmallWidgetProvider.class);
|
||||
final AppWidgetManager manager = AppWidgetManager.getInstance(this);
|
||||
|
||||
try {
|
||||
view.setTextViewText(R.id.counter, String.valueOf(""));
|
||||
view.setViewVisibility(R.id.progress, View.VISIBLE);
|
||||
|
||||
manager.updateAppWidget(thisWidget, view);
|
||||
|
||||
final SharedPreferences m_prefs = PreferenceManager
|
||||
@ -126,6 +127,13 @@ public class WidgetUpdateService extends Service {
|
||||
|
||||
ar.execute(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
view.setViewVisibility(R.id.progress, View.GONE);
|
||||
view.setTextViewText(R.id.counter, getString(R.string.app_name));
|
||||
manager.updateAppWidget(thisWidget, view);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user