--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/03/16 10:10:55 629 +++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/03/17 15:27:11 630 @@ -18,6 +18,7 @@ import android.os.Handler; import android.os.Message; +import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.Menu; @@ -507,8 +508,12 @@ public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } - }); - builder.show(); + }); + try { + builder.show(); + } catch (android.view.WindowManager.BadTokenException e) { + Log.i("StationList", "BadTokenException"); // this can happen if the user switched away from this activity, while doInBackground was running + } } } }