--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/01/27 06:07:27 555 +++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2010/01/27 06:14:00 556 @@ -209,8 +209,8 @@ message.append("-Longitude: ").append( loc.getLongitude() ).append("\n"); } else { message.append(" - No location data!"); - } - + } + MessageBox.showMessage(this, message.toString()); break; default: @@ -229,6 +229,19 @@ } + + public void showMessageAndClose(String message) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(message) + .setCancelable(false) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + StationList.this.finish(); + } + }) + .show(); + } @@ -258,7 +271,7 @@ if (et.getText().toString().length() >= 2) { startNameSearch(et.getText().toString()); } else { - MessageBox.showMessage(StationList.this, "Two characters minimum" ); + showMessageAndClose("Two characters minimum"); } } }); @@ -347,7 +360,7 @@ findStationsTask.searchByIds(favorites.toString(), locationLookup.getLocation()); findStationsTask.execute(); } else { - MessageBox.showMessage(this, "Favorite list is empty"); + showMessageAndClose( "Favorite list is empty"); } }