```ActivityResultLauncher<Intent> vpnLaunche...
# android
c
Copy code
ActivityResultLauncher<Intent> vpnLauncher = registerForActivityResult(
        new ActivityResultContracts.StartActivityForResult(),
        new ActivityResultCallback<ActivityResult>() {
            @Override
            public void onActivityResult(ActivityResult result) {
                if (result.getResultCode() != Activity.RESULT_OK) {
                    app.startProxyService();
                }
            }
        });
You can see how ugly this api is: redundant, repetitive, vague to understand. Obviously It can be simplified like this: Launcher<Intent> vpnLaucher = new Launcher().onResult((Result result) { .... })
not kotlin but kotlin colored 3
🤔 1
i
The split between the unconditional registration and the
launch
is intentional and necessary: https://kotlinlang.slack.com/archives/C0B8M7BUY/p1694440647301139?thread_ts=1694438126.574999&amp;cid=C0B8M7BUY
c
The only problem is that Android is not good designed, components' parents are not recorded, and return data can not be send back to their parents by default.
In fact there need no separate launchers.