widget: if final json request fails, do not crash
This commit is contained in:
parent
068bc6bb81
commit
d363cb5346
@ -78,18 +78,22 @@ public class WidgetUpdateService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(JsonElement result) {
|
protected void onPostExecute(JsonElement result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
JsonObject content = result.getAsJsonObject();
|
try {
|
||||||
|
JsonObject content = result.getAsJsonObject();
|
||||||
if (content != null) {
|
|
||||||
int unread = content.get("unread").getAsInt();
|
if (content != null) {
|
||||||
|
int unread = content.get("unread").getAsInt();
|
||||||
view.setViewVisibility(R.id.progress, View.GONE);
|
|
||||||
view.setTextViewText(R.id.counter, String.valueOf(unread));
|
view.setViewVisibility(R.id.progress, View.GONE);
|
||||||
manager.updateAppWidget(thisWidget, view);
|
view.setTextViewText(R.id.counter, String.valueOf(unread));
|
||||||
|
manager.updateAppWidget(thisWidget, view);
|
||||||
return;
|
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
view.setViewVisibility(R.id.progress, View.GONE);
|
view.setViewVisibility(R.id.progress, View.GONE);
|
||||||
view.setTextViewText(R.id.counter, "?");
|
view.setTextViewText(R.id.counter, "?");
|
||||||
|
Loading…
Reference in New Issue
Block a user