title: binding to a suspended function in android
body: <p>I want to bind a button click to a suspended function inside viewmodel.</p>
  
  <p>this is my code:</p>
  
  <p><strong>RegistrationActivityViewModel.kt</strong></p>
  
  <pre><code>    suspend fun register() {
          if (validateFields()) {
              val result = SourceplusplusApiService.invoke().registerUser(username.value!!, email.value!!, password.value!!).await()
              isRegistrationCompleted.value = getResultValue(result)
          }
      }
  </code></pre>
  
  <p><strong>activity_registration.xml</strong></p>
  
  <pre><code>&lt;Button
            android:text="Register"
            android:onClick="@{()-&gt;viewmodel.register()}"
            android:textSize="16sp" /&gt;
  </code></pre>
  
  <p>i get a databinding error that says <code>ActivityRegistrationBindingImpl</code> not generated. after searching a lot i realized that when i remove the <code>suspend</code> keyword and comment the code inside, it works fine but it has to be a suspended function.</p>
  
  <p>Does anyone know how to fix it?</p>