title: startActivityForResult is deprecated and, unable to request for bluetooth connection with new code
body: <pre class="lang-java prettyprint-override"><code>Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
  startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
  </code></pre>
  <p>I was requesting to start Bluetooth using above source code. But, <code>startActivityForResult</code> is deprecated. So, I was searching for new code how to deal with that. Here's <a href="https://stackoverflow.com/a/63654043/16241416">the solution</a> I found.</p>
  <pre class="lang-java prettyprint-override"><code>// You can do the assignment inside onAttach or onCreate, i.e, before the activity is displayed
      ActivityResultLauncher&lt;Intent&gt; someActivityResultLauncher = registerForActivityResult(
              new ActivityResultContracts.StartActivityForResult(),
              new ActivityResultCallback&lt;ActivityResult&gt;() {
                  @Override
                  public void onActivityResult(ActivityResult result) {
                      if (result.getResultCode() == Activity.RESULT_OK) {
                          // There are no request codes
                          Intent data = result.getData();
                          doSomeOperations();
                      }
                  }
              });
  
      public void openSomeActivityForResult() {
          Intent intent = new Intent(this, SomeActivity.class);
          someActivityResultLauncher.launch(intent);
      }
  </code></pre>
  <p>I added it to my source code.</p>
  <pre class="lang-java prettyprint-override"><code>            Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
  //            startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
  
              ActivityResultLauncher&lt;Intent&gt; someActivityResultLauncher = registerForActivityResult(
                      new ActivityResultContracts.StartActivityForResult(),
                      new ActivityResultCallback&lt;ActivityResult&gt;() {
                          @Override
                          public void onActivityResult(ActivityResult result) {
                              if (result.getResultCode() == Activity.RESULT_OK) {
                                  // There are no request codes
                                  Intent data = result.getData();
  //                                doSomeOperations();
                              }
                          }
                      });
  
              someActivityResultLauncher.launch(enableBtIntent);
  </code></pre>
  <p>But, Android is requesting for bluetooth permission automatically for old source code (I didn't have to add onActivityResult function. Cause, it was earlier written in background). But, when I am using ActivityResultLauncher I must add onActivityResult function(I can work without onActivityResult also But, <code>startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);</code> I had sent an integer value also <code>REQUEST_ENABLE_BT=1</code>). How can I request for bluetooth permission with new code?</p>