New > New Project (include Kotlin Support : check)
Android > Preferences > plugins > Kotlin > install
Code > Convert Java File to Kotlin File
Tools > Kotlin > Configure Kotlin in Project
Android > Preferences > plugins > Kotlin > install
Code > Convert Java File to Kotlin File
Tools > Kotlin > Configure Kotlin in Project
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main)
val v = getVal() println("Hello World") println("v = $v") val textView = findViewById<TextView>(R.id.textview) textView.text =v } private fun getVal():String{ return "Hello Kotlin!"
}
}
댓글
댓글 쓰기