--- android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java 2011/07/08 12:11:49 1554 +++ android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java 2011/07/08 12:24:48 1555 @@ -2,6 +2,8 @@ +import java.io.InvalidClassException; + import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; @@ -86,27 +88,32 @@ if (sp instanceof OfflineStationProvider ) { OfflineStationProvider osp = (OfflineStationProvider) sp; - try { - - long last = prefs.getLong(stationsreload, 0); - long now = System.currentTimeMillis(); + long last = prefs.getLong(stationsreload, 0); + long now = System.currentTimeMillis(); + Log.i("TrainInfo", "Last Load: " + last); + + if ( (now-last) > (14*24*60*60*1000) ) { + new StationLoader(osp).execute( (Void)null); + } else { + + boolean didLoad = false; - Log.i("TrainInfo", "Last Load: " + last); + try { + didLoad = osp.loadStations(this); + } + catch (InvalidClassException e) { + Log.i("TrainInfo", "invalid class - do a new download of stationlist"); + } + catch (Exception e) { + Toast.makeText(this, "" + e.getMessage(), Toast.LENGTH_SHORT).show(); + Log.e("TrainInfo", "load error", e); + } - if ( (now-last) > (14*24*60*60*1000) ) { + if (didLoad == false) { new StationLoader(osp).execute( (Void)null); - } else { - - boolean didLoad = osp.loadStations(this); - - if (didLoad == false) { - new StationLoader(osp).execute( (Void)null); - } } - - } catch (Exception e) { - Toast.makeText(this, "" + e.getMessage(), Toast.LENGTH_SHORT).show(); } + } }