title: How do you get an ActivityResultRegistry reference from an Activity?
body: <p>I'm trying to get this example code to work in Java:</p>
  <blockquote>
  <p><a href="https://developer.android.com/training/basics/intents/result" rel="nofollow noreferrer">https://developer.android.com/training/basics/intents/result</a></p>
  <pre><code>private final ActivityResultLauncher&lt;Void&gt; mTakePicture =
          registerForActivityResult(new TakePicturePreview(), mRegistry, new ActivityResultCallback&lt;Bitmap&gt;() {
              @Override
              public void onActivityResult(Bitmap thumbnail) {
                  mThumbnailLiveData.setValue(thumbnail);
              }
      });
  </code></pre>
  </blockquote>
  <p>The example happens to be a &quot;Fragment&quot;, and it gets mRegistry from the constructor:</p>
  <pre><code>public class MyFragment extends Fragment {
      private final ActivityResultRegistry mRegistry;
      ...
      public MyFragment(@NonNull ActivityResultRegistry registry) {
          super();
          mRegistry = registry;
      }
  </code></pre>
  <p>My test case is an Activity (the &quot;MainActivity&quot;), not a Fragment:</p>
  <pre><code>public class MainActivity extends AppCompatActivity {
      ...
      private  ActivityResultRegistry activityResultRegistry;
  </code></pre>
  <p>Q: How can I initialize my registry (&quot;activityResultRegistry&quot;) in this scenario?</p>