[JAVA] Screen transition using Intent in Kotlin

About screen transition using Intent in android studio Kotlin

It's been a while since I started learning Kotlin, so I wondered how to write code that I used to write in Java in Kotlin, so I briefly wrote screen transitions using Intent.

There was a slightly different notation from Java, so I've summarized it this time.

Java


Intent intent = Intent(MainActivity.this, SecondActivity.class)
startActivity(intent)

This was a screen transition using Intent in Java, so in Kotlin,

Kotlin


val intent: Intent = Intent(MainActivity.this, SecondActivity.class)
startActivity(intent)

When I thought that I could go with this, I got an error

After investigating various things,

Kotlin


val intent = Intent(this, SecondActivity::class.java)
startActivity(intent)

This person was able to make a screen transition. It seems that it was simply written incorrectly,

::class.java


 The part did not come with a bad pin ...

class.java

 I think that part means that it's a Java class, but ...

 I will add it as soon as I understand it.


Recommended Posts

Screen transition using Intent in Kotlin
Android development ~ Screen transition (intent) ~
HMAC in Kotlin
Screen transition method
Screen transition memorandum
JavaFX8 screen transition
[Android / Java] Screen transition and return processing in fragments
How to send value in HTML without screen transition
Big Decimal in Kotlin
I want to transition to the same screen in the saved state
Try using RocksDB in Java
[Swift] Simple screen transition summary
Japaneseize using i18n with Rails
[Java] Get KClass in Java [Kotlin]
Using Amateurs UML in Eclipse
Try using gRPC in Ruby
Screen transition Information transfer memorandum
Animation settings at screen transition
Apache POI Excel in Kotlin
Implementation of HashMap in kotlin
Screen transition with swing, java
[Android] Convert Map to JSON using GSON in Kotlin and Java