title: How to replace startActivityForResult with Activity Result APIs?
body: <p>I have a main activity which serves as an entry point to call different activities, depending on condition. Among others, I use Firebase Auth to manage user sign in:</p>
  
  <pre><code>startActivityForResult(
              AuthUI.getInstance().createSignInIntentBuilder()
                      .setAvailableProviders(providers)
                      .build(),
              RC_SIGN_IN)
  </code></pre>
  
  <p>I overwrite <code>onActivityResult()</code> to distinguish the returned intent/data, for example:</p>
  
  <pre><code> override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
      super.onActivityResult(requestCode, resultCode, data)
      when (requestCode) {
  
          REQUEST_CODE_1 -&gt; {
            // update UI and stuff
          }
  
          RC_SIGN_IN -&gt; {
            // check Firebase log in
          }
          // ...
      }
  }
  </code></pre>
  
  <p>With the Activity Result APIs which is strongly recommended by the <a href="https://developer.android.com/training/basics/intents/result" rel="noreferrer">documentation</a>, I get that I should make <code>prepareCall()</code> before <code>ActivityResultLauncher</code> and to make sure the activity is in created state when I launch, but I still don't understand how to handle multiple activity results gracefully (at least, in one place) like in <code>onActivityResult()</code>.</p>
  
  <p>Looking at <a href="https://adambennett.dev/2020/03/introducing-the-activity-result-apis/" rel="noreferrer">this article</a>, it seems I need to implement <em>multiple</em> child inner classes of <code>ActivityResultContract</code> type (therefore multiple <code>prepareCall()</code>'s?), because they are suppose to be different <em>contracts</em>, am I correct? Can someone please show me some skeleton example that mirrors the above <code>onActivityResult()</code> logic?</p>