--- android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2011/05/04 20:25:15 1446 +++ android/TrainInfo/src/dk/thoerup/traininfo/StationList.java 2011/05/05 05:00:30 1447 @@ -73,8 +73,8 @@ - public static final int OPTIONS_MAP = 2003; - public static final int OPTIONS_GPSINFO = 2004; + public static final int OPTIONS_MAP = 1003; + public static final int OPTIONS_GPSINFO = 1004; public static final int DLG_PROGRESS = 3001; public static final int DLG_STATIONNAME = 3002; @@ -231,10 +231,15 @@ item.setIcon(android.R.drawable.ic_menu_mapmode); item = menu.add(0, OPTIONS_GPSINFO, 0, getString(stationlist_gpsinfo)); - item.setIcon(android.R.drawable.ic_menu_mapmode); + item.setIcon(android.R.drawable.ic_menu_mapmode); + boolean hasLoc = (locationLookup.getLocation() != null); + item.setEnabled(hasLoc); return true; } + + + @Override public boolean onOptionsItemSelected(MenuItem item) { @@ -259,14 +264,12 @@ Location loc = locationLookup.getLocation(); StringBuffer message = new StringBuffer(); message.append( getString(stationlist_locationinfo) ).append(":\n"); - if (loc != null) { - message.append( getString(stationlist_obtainedby) ).append( loc.getProvider() ).append("\n"); - message.append( getString(stationlist_accuracy) ).append( (int)loc.getAccuracy()).append("m\n"); - message.append( getString(stationlist_latitude) ).append( (float)loc.getLatitude()).append("\n"); - message.append( getString(stationlist_longitude) ).append( (float)loc.getLongitude() ).append("\n"); - } else { - message.append( getString(stationlist_nolocation) ); - } + + message.append( getString(stationlist_obtainedby) ).append( loc.getProvider() ).append("\n"); + message.append( getString(stationlist_accuracy) ).append( (int)loc.getAccuracy()).append("m\n"); + message.append( getString(stationlist_latitude) ).append( (float)loc.getLatitude()).append("\n"); + message.append( getString(stationlist_longitude) ).append( (float)loc.getLongitude() ).append("\n"); + MessageBox.showMessage(this, message.toString(), false); break;