From: gu.martinm@gmail.com Date: Sun, 31 Aug 2014 23:28:19 +0000 (+0200) Subject: Android WeatherInformation: X-Git-Tag: weatherinformation-1.0~157 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=f7efa4f3461d396129b907eda43b5f8335ccc4cd;p=AndroidWeatherInformation Android WeatherInformation: check null value (current and forecast) before trying to update UI. --- diff --git a/src/de/example/exampletdd/fragment/current/CurrentFragment.java b/src/de/example/exampletdd/fragment/current/CurrentFragment.java index cd79d9b..8f3bd53 100644 --- a/src/de/example/exampletdd/fragment/current/CurrentFragment.java +++ b/src/de/example/exampletdd/fragment/current/CurrentFragment.java @@ -318,6 +318,12 @@ public class CurrentFragment extends ListFragment { @Override protected void onPostExecute(final Current current) { + + if (current == null) { + // Nothing to do + return; + } + // Call updateUI on the UI thread. updateUI(current); diff --git a/src/de/example/exampletdd/fragment/overview/OverviewFragment.java b/src/de/example/exampletdd/fragment/overview/OverviewFragment.java index a7aa902..d2cfbc1 100644 --- a/src/de/example/exampletdd/fragment/overview/OverviewFragment.java +++ b/src/de/example/exampletdd/fragment/overview/OverviewFragment.java @@ -306,6 +306,12 @@ public class OverviewFragment extends ListFragment { @Override protected void onPostExecute(final Forecast forecast) { + + if (forecast == null) { + // Nothing to do + return; + } + // Call updateUI on the UI thread. updateUI(forecast); diff --git a/src/de/example/exampletdd/fragment/specific/SpecificFragment.java b/src/de/example/exampletdd/fragment/specific/SpecificFragment.java index 542749e..7339dd4 100644 --- a/src/de/example/exampletdd/fragment/specific/SpecificFragment.java +++ b/src/de/example/exampletdd/fragment/specific/SpecificFragment.java @@ -37,8 +37,10 @@ public class SpecificFragment extends ListFragment { final Bundle extras = this.getActivity().getIntent().getExtras(); if (extras != null) { + // handset layout this.mChosenDay = extras.getInt("CHOSEN_DAY", 0); } else { + // tablet layout // Always 0 when tablet layout. this.mChosenDay = 0; }