--- android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java 2011/07/08 17:39:35 1566 +++ android/TrainInfo/src/dk/thoerup/traininfo/WelcomeScreen.java 2011/07/09 07:20:57 1567 @@ -47,6 +47,8 @@ SharedPreferences prefs; + StationLoader stationLoader; + @Override public void onCreate(Bundle savedInstanceState) { @@ -93,7 +95,8 @@ Log.i("TrainInfo", "Last Load: " + last); if ( (now-last) > (14*24*60*60*1000) ) { - new StationLoader(osp).execute( (Void)null); + stationLoader = new StationLoader(osp); + stationLoader.execute( (Void)null); } else { boolean didLoad = false; @@ -110,7 +113,8 @@ } if (didLoad == false) { - new StationLoader(osp).execute( (Void)null); + stationLoader = new StationLoader(osp); + stationLoader.execute( (Void)null); } } @@ -122,6 +126,10 @@ @Override protected void onDestroy() { super.onDestroy(); + if (stationLoader != null) { + stationLoader.cancel(false); + } + ProviderFactory.purgeOldEntries(); //exiting application, do some cleanup }