Hi, I keep seeing intents with java classes as an ...
# getting-started
t
Hi, I keep seeing intents with java classes as an argument, but I'm not sure how to use a Kotlin one instead?
val i = Intent(this, ExampleJavaClass::class.java)
k
That's the code for a Kotlin class too.
::class.java
doesn't mean "this is a Java class", it means "give me a
java.lang.Class
instead of a `KClass`".
(for next time, there's #android for android-specific Kotlin questions)
✔️ 1
t
ahh sorry, I thought it was so basic that I should be asking here 😕
a
to add to above,
Intent
constructor expects
Class
not
KClass
, that's why you need to use
::class.java
k
Sure, this question was a bit of a grey area, it was just a tip.