Install in Studio
Go to File --> Settings -->Pluins-->install jet brains plugin-->select kotlin -->Download and install
Restart IDE
Sample Project
--------------------
Create new project
Open MainActivity and then type ctrl+Alt+shft+k
File gets converted to kotlin file
Access UI components in Kotlin file
---------------------------------------------------
Add this import in MainActivity.java "import kotlinx.android.synthetic.main.activity_main.textView;"
Access directly in oncreate as follows
Go to File --> Settings -->Pluins-->install jet brains plugin-->select kotlin -->Download and install
Restart IDE
Sample Project
--------------------
Create new project
Open MainActivity and then type ctrl+Alt+shft+k
File gets converted to kotlin file
Access UI components in Kotlin file
---------------------------------------------------
Add this import in MainActivity.java "import kotlinx.android.synthetic.main.activity_main.textView;"
Access directly in oncreate as follows
textView.setText("This is kotlin example")
Done build and run:)
No comments:
Post a Comment