title: How do I share a Observablelist between 2 controllers , I have tried various methods but I get null pointer exceptions
body: <p>I am absolutely new to coding and am stuck with some "binding" code. I have a Record class with getters and setters, and a records Observable list which together populate a Tableview in a controller called RecordController. I want to populate another tableview on a separate  AdminController file both with different view fxml's.</p>
  
  <p>How can I bind the SimpleStringProperties in my Record.java class in such a manner that when they get updated by by the set method( by any UI user interaction) in RecordContoller ..the (editatble) Tableview in the AdminController gets populated with the new values.</p>
  
  <p>Some bits of the code.....</p>
  
  <pre><code>public class Record {
  
  private final SimpleStringProperty stationName;
  private final SimpleStringProperty staffName;
  private final SimpleStringProperty staffNumber;
  private final SimpleStringProperty agencyName;
  private final SimpleStringProperty aircraftType;
  private final SimpleStringProperty issueDate;
  private final SimpleStringProperty validTill;
  
  
  public Record(String stationName, String staffName,
          String staffNumber, String agencyName, String aircraftType,
          String issueDate, String validTill) {
      this.stationName = new SimpleStringProperty(stationName);
      this.staffName = new SimpleStringProperty(staffName);
      this.staffNumber = new SimpleStringProperty(staffNumber);
      this.aircraftType = new SimpleStringProperty(aircraftType);
      this.agencyName = new SimpleStringProperty(agencyName);
      this.issueDate = new SimpleStringProperty(issueDate);
      this.validTill = new SimpleStringProperty(validTill);
  
  }
  
  public String getStationName() {
  
      return stationName.getValue();
  }
  
  public String getStaffName() {
      return staffName.getValue();
  }
  
  public String getStaffNumber() {
      return staffNumber.getValue();
  }
  
  public String getAgencyName() {
      return agencyName.getValue();
  }
  
  public String getAircraftType() {
      return aircraftType.getValue();
  }
  
  public String getIssueDate() {
      return issueDate.getValue();
  }
  
  public String getValidTill() {
      return validTill.getValue();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And the RecordController with the first Tableview.....</p>
  
  <pre><code>columnStation.setCellValueFactory(new PropertyValueFactory&lt;&gt;("stationName"));
      columnStaffName.setCellValueFactory(new PropertyValueFactory&lt;&gt;("staffName"));
      columnStaffNumber.setCellValueFactory(new PropertyValueFactory&lt;&gt;("staffNumber"));
      columnAgency.setCellValueFactory(new PropertyValueFactory&lt;&gt;("agencyName"));
      columnAircraftType.setCellValueFactory(new PropertyValueFactory&lt;&gt;("aircraftType"));
      columnIssueDate.setCellValueFactory(new PropertyValueFactory&lt;&gt;("issueDate"));
      columnValidTill.setCellValueFactory(new PropertyValueFactory&lt;&gt;("validTill"));
  
  
      recordTableView.setItems(null);
      recordTableView.setItems(records);
  </code></pre>
  
  <p>The records observable list being .....</p>
  
  <pre><code>private ObservableList&lt;Record&gt; records=FXCollections.observableArrayList();
  </code></pre>
  
  <p>The adminController for the other fxml also has another tableview which I want to populate in some way with the property variables in the Record.java (class / bean ? ). </p>