Buggy code:
public class DatabaseHandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1 ; private static final String DATABASE_NAME = "bamftRecords" ; private static final String TABLE_LANDMARKS = "landmarks" ; private static final String TABLE_TRUCKS = "trucks" ; private static final String TABLE_SCHEDULES = "schedules" ; private static final String KEY_LANDMARK_ID = "id" ; private static final String KEY_LANDMARK_NAME = "name" ; private static final String KEY_LANDMARK_XCOORD = "xcoord" ; private static final String KEY_LANDMARK_YCOORD = "ycoord" ; private static final String KEY_TRUCK_ID = "id" ; private static final String KEY_TRUCK_NAME = "name" ; private static final String KEY_TRUCK_CUISINE = "cuisine" ; private static final String KEY_TRUCK_DESCRIPTION = "description" ; private static final String KEY_SCHEDULE_ID = "id" ; private static final String KEY_SCHEDULE_DAY_OF_WEEK = "day_of_week" ; private static final String KEY_SCHEDULE_TIME_OF_DAY = "time_of_day" ; private static final String KEY_SCHEDULE_TRUCK_ID = "truck_id" ; private static final String KEY_SCHEDULE_LANDMARK_ID = "landmark_id" ; public DatabaseHandler ( Context context ) { } @ Override public void onCreate ( SQLiteDatabase db ) { } @ Override public void onUpgrade ( SQLiteDatabase db , int oldVersion , int newVersion ) { } public void recreateTables ( ) { } public List < Schedule > getSchedulesByDayAndTime ( String dayOfWeek , String timeOfDay ) { } void addLandmark ( Landmark landmark ) { } void addTruck ( Truck truck ) { } void addSchedule ( Schedule schedule ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; ContentValues values = new ContentValues ( ) ; values . put ( DatabaseHandler . KEY_SCHEDULE_ID , schedule . getId ( ) ) ; values . put ( DatabaseHandler . KEY_SCHEDULE_DAY_OF_WEEK , schedule . getDayOfWeek ( ) ) ; values . put ( DatabaseHandler . KEY_SCHEDULE_TIME_OF_DAY , schedule . getTimeOfDay ( ) ) ; values . put ( DatabaseHandler . KEY_SCHEDULE_TRUCK_ID , schedule . getTruckId ( ) ) ; <START_BUG> values . put ( DatabaseHandler . KEY_SCHEDULE_LANDMARK_ID , schedule . getId ( ) ) ; <END_BUG> db . insert ( DatabaseHandler . TABLE_SCHEDULES , null , values ) ; db . close ( ) ; } Landmark getLandmark ( int id ) { } Truck getTruck ( int id ) { } Schedule getSchedule ( int id ) { } public List < Landmark > getAllLandmarks ( ) { } public List < Truck > getAllTrucks ( ) { } public List < Schedule > getAllSchedules ( ) { } public int updateLandmark ( Landmark landmark ) { } public int updateTruck ( Truck truck ) { } public int updateSchedule ( Schedule schedule ) { } public void deleteLandmark ( Landmark landmark ) { } public void deleteTruck ( Truck truck ) { } public void deleteSchedule ( Schedule schedule ) { } public int getLandmarksCount ( ) { } public int getTrucksCount ( ) { } public int getSchedulesCount ( ) { } private List < Landmark > getLandmarksListByQuery ( String selectQuery ) { } private List < Truck > getTrucksListByQuery ( String selectQuery ) { } private List < Schedule > getSchedulesListByQuery ( String selectQuery ) { } }

Fix:
values . put ( DatabaseHandler . KEY_SCHEDULE_LANDMARK_ID , schedule . getLandmarkId ( ) ) ;