title: Using async/await still blocks UI on Xamarin.Android
body: <p>I'm working on a Xamarin.Android project and the app needs to consume web service before updating the UI. I applied async/await but it still blocks the UI. </p>
  
  <p>Here is the UI code</p>
  
  <pre><code>    private async void Login(object sender, EventArgs e)
      {
          var username = _usernamEditText.Text.Trim();
          var password = _passwordEditText.Text.Trim();
          var progressDialog = ProgressDialog.Show(this, "", "Logging in...");
          var result = await _userService.AuthenticateAsync(username, password);
  
          progressDialog.Dismiss();
      }
  </code></pre>
  
  <p>Here is the service code</p>
  
  <pre><code>public async Task&lt;AuthenticationResult&gt; AuthenticateAsync(string username, string password)
      {
          using (var httpClient = CreateHttpClient())
          {
              var url = string.Format("{0}/token", Configuration.ServiceBaseUrl);
              var body = new List&lt;KeyValuePair&lt;string, string&gt;&gt;
              {
                  new KeyValuePair&lt;string, string&gt;("username", username),
                  new KeyValuePair&lt;string, string&gt;("password", password),
                  new KeyValuePair&lt;string, string&gt;("grant_type", "password")
              };
              var response = httpClient.PostAsync(url, new FormUrlEncodedContent(body)).Result;
              var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
              var obj = new JSONObject(content);
              var result = new AuthenticationResult {Success = response.IsSuccessStatusCode};
  
              if (response.IsSuccessStatusCode)
              {
                  result.AccessToken = obj.GetString("access_token");
                  result.UserName = obj.GetString("userName");
              }
              else
              {
                  result.Error = obj.GetString("error");
  
                  if (obj.Has("error_description"))
                  {
                      result.ErrorDescription = obj.GetString("error_description");
                  }
              }
  
              return result;
          }
      }
  </code></pre>
  
  <p>Do I miss anything? Thank you.</p>