public void waitForEmulator() throws CoreException {
    while (true) {
      List<AndroidDevice> devices = this.listDevices();
      if (devices != null) {
        for (AndroidDevice androidDevice : devices) {
          if (androidDevice.isEmulator() && androidDevice.getState() == AndroidDevice.STATE_DEVICE)
            return;
        }
      }
      try {
        Thread.sleep(200);
      } catch (InterruptedException e) {

      }
    }
  }