--- android/TrainInfo/src/dk/thoerup/traininfo/TimetableList.java 2011/04/23 08:01:57 1373 +++ android/TrainInfo/src/dk/thoerup/traininfo/TimetableList.java 2011/05/28 17:50:45 1488 @@ -21,8 +21,9 @@ import android.view.View; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; import dk.thoerup.android.traininfo.common.DepartureEntry; -import dk.thoerup.android.traininfo.common.StationBean.StationEntry; +import dk.thoerup.android.traininfo.common.StationEntry; import dk.thoerup.android.traininfo.common.TimetableBean; import dk.thoerup.android.traininfo.common.TimetableEntry; import dk.thoerup.traininfo.provider.ProviderFactory; @@ -105,16 +106,16 @@ protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); - TimetableEntry tt = timetables.entries.get(position); - - StationEntry station = new StationEntry(); - station.setName( tt.getStation() ); - station.setId( tt.getStationId() ); - station.setIsRegional(true); + if (timetables == null || timetables.entries == null || timetables.entries.size() == 0) { + Toast.makeText(this, "No timetables in list !?", Toast.LENGTH_LONG).show(); //TODO Translate + return; + } + TimetableEntry tt = timetables.entries.get(position); + Intent intent = new Intent(this, DepartureList.class); - intent.putExtra("stationbean", station); + intent.putExtra("stationbean", tt.getStationEntry() ); startActivity(intent); } @@ -186,7 +187,7 @@ super.onPostExecute(result); dismissDialog(DLG_PROGRESS); - //TODO: differentiate between a communication error and a downed bane.dk site + if (timetables != null && timetables.errorCode == null) { commFailCounter = 0; TimetableList.this.getListView().invalidateViews();