First or second? ```startActivityForResult( C...
# codingconventions
t
First or second?
Copy code
startActivityForResult(
    CheatActivity.newIntent(this@MainActivity, quizViewModel.currentQuestionAnswer),
    REQUEST_CODE_CHEAT,
    ActivityOptions.makeCustomAnimation(
        this,
        R.anim.fragment_fade_enter,
        R.anim.fragment_fade_exit
    ).toBundle()
)
Copy code
val intent = CheatActivity.newIntent(this@MainActivity, quizViewModel.currentQuestionAnswer)
val animation = ActivityOptions.makeCustomAnimation(this, R.anim.fragment_fade_enter, R.anim.fragment_fade_exit).toBundle()
startActivityForResult(intent, REQUEST_CODE_CHEAT, animation)
e
neither, use the new activity result apis instead
t
@ephemient how do I do that
e
t
@ephemient this is Kotlin
e
your code is, but the API is not, and that's what you should have looked up yourself after my first reply.
and enough with the unwarranted @therealbluepandabear @therealbluepandabear @therealbluepandabear @therealbluepandabear @therealbluepandabear pings already
t
most Kotlin devs use Java APIs in their projects.
also how am I supposed to know whether it's Java API or Kotlin API?
e
yes, but don't come here asking about the Java parts. do your own research.
t
reminds me of something else lol
Nevermind.
m
kotlin-specific part: maybe I’ll go with the first form, using named arguments for clarity:
Copy code
startActivityForResult(
    intent = CheatActivity.newIntent(this@MainActivity, quizViewModel.currentQuestionAnswer),
    code = REQUEST_CODE_CHEAT,
    bundle = ActivityOptions.makeCustomAnimation(
        this,
        R.anim.fragment_fade_enter,
        R.anim.fragment_fade_exit
    ).toBundle()
)
As for the Android-specific part, I know next to nothing so forgive me in advance (for example arg names are surely wrong).
e
unfortunately named arguments don't work with Java APIs
m
oh rats! I forgot that 😞