```public void onBraintreeSubmit(View v) { DropI...
# compose
j
Copy code
public void onBraintreeSubmit(View v) {
  DropInRequest dropInRequest = new DropInRequest()
    .tokenizationKey("sandbox_************");
  startActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
}
1
this part in kotlin makes sense
Copy code
val dropInRequest = DropInRequest()
    .tokenizationKey("sandbox_************")
but how does startActivityForResult translate to jetpack compose? I assume this launches the drop in UI and braintree does the rest
j
Copy code
val dropInHintLauncher = rememberLauncherForActivityResult(
    contract = ActivityResultContracts.StartIntentSenderForResult()
) {
    print("pause here")
}
val dropInIntent = dropInRequest.getIntent(context)
dropInHintLauncher.launch(
    IntentSenderRequest.Builder()
)
got that far. trying to figure out how to launch it next with intent sender request
Copy code
val dropInIntent = dropInRequest.getIntent(context)
dropInHintLauncher.launch(
    IntentSenderRequest.Builder(dropInIntent)
)
but Builder wants PendingIntent or IntentSender
Well it won't let me pass this function as a Composable function to a clickable method...
Copy code
@Composable
fun launchDropInUi(context: Context, user: FinUser){
    val customerToken = user.userData["customerToken"] as String
    val dropInRequest = DropInRequest()
        .clientToken(customerToken)

    val dropInHintLauncher = rememberLauncherForActivityResult(
        contract = ActivityResultContracts.StartIntentSenderForResult()
    ) {
        print("pause here")
    }
    val dropInIntent = dropInRequest.getIntent(context)
    val dropInPendingIntent = PendingIntent.getBroadcast(
        context, tag, dropInIntent,
        PendingIntent.FLAG_UPDATE_CURRENT
    )
    dropInHintLauncher.launch(
        IntentSenderRequest.Builder(dropInPendingIntent).build()
    )
}
Woohoo! got it!
🎉 2