check null value (current and forecast) before trying to update UI.
@Override
protected void onPostExecute(final Current current) {
+
+ if (current == null) {
+ // Nothing to do
+ return;
+ }
+
// Call updateUI on the UI thread.
updateUI(current);
@Override
protected void onPostExecute(final Forecast forecast) {
+
+ if (forecast == null) {
+ // Nothing to do
+ return;
+ }
+
// Call updateUI on the UI thread.
updateUI(forecast);
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;
}