https://kotlinlang.org logo
Title
t

therealbluepandabear

04/11/2021, 11:36 PM
First or second?
startActivityForResult(
    CheatActivity.newIntent(this@MainActivity, quizViewModel.currentQuestionAnswer),
    REQUEST_CODE_CHEAT,
    ActivityOptions.makeCustomAnimation(
        this,
        R.anim.fragment_fade_enter,
        R.anim.fragment_fade_exit
    ).toBundle()
)
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

ephemient

04/11/2021, 11:51 PM
neither, use the new activity result apis instead
t

therealbluepandabear

04/11/2021, 11:58 PM
@ephemient how do I do that
e

ephemient

04/12/2021, 12:01 AM
t

therealbluepandabear

04/12/2021, 12:02 AM
@ephemient this is Kotlin
e

ephemient

04/12/2021, 12:02 AM
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

therealbluepandabear

04/12/2021, 12:03 AM
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

ephemient

04/12/2021, 12:06 AM
yes, but don't come here asking about the Java parts. do your own research.
t

therealbluepandabear

04/12/2021, 12:08 AM
reminds me of something else lol
Nevermind.
m

Matteo Mirk

04/12/2021, 9:16 AM
kotlin-specific part: maybe I’ll go with the first form, using named arguments for clarity:
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

ephemient

04/13/2021, 2:34 AM
unfortunately named arguments don't work with Java APIs
m

Matteo Mirk

04/13/2021, 7:22 AM
oh rats! I forgot that 😞