private void removeListeners() {
   // empty the query loop
   MainActivity.device.clearFields();
   // free up the listeners again
   for (Field field : subscribedFields) {
     field.removeListener(this);
   }
   subscribedFields.clear();
 }
예제 #2
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    // free up the listeners again
    for (Field field : subscribedFields) {
      field.removeListener(this);
    }
    subscribedFields.clear();
  }
예제 #3
0
 private void registerApplicationFields() {
   if (safeDrivingMode) {
     // speed
     Field field = fields.getBySID("5d7.0");
     field.addListener(MainActivity.getInstance());
     if (device != null) device.addApplicationField(field, 1000); // query every second
   } else {
     Field field = fields.getBySID("5d7.0");
     field.removeListener(MainActivity.getInstance());
     if (device != null) device.removeApplicationField(field);
   }
 }