Wednesday, February 14, 2018

Kotlin getting started and Coding conventions

                  

How to initialise 
the class in Kotlin
Standard class CLASSNAME : PARENTCLASS, INTERFACE{
}
Example :
class SelectPicActivity: GalleryActivity, CallBackInterface{
}


How to initialise/declare the variable in Kotlin

private var uriString : String? =null
private var mCurrentPath = ""
private var REQUEST_IMAGE_PIC = 2
private var REQUEST_IMAGE_SELECT = 1


How to create method/function in Kotlin

Standard :
fun methodName(): Return{
}
Example : fun getFileName() : String{
//Write your code here var = "sd/test/stpe.jpeg"
return var
}

How to initialise the Arraylist/collections 

val mylist: ArrayList<T> = ArrayList<T>() //Add elements to mylist mylist.add("text")
println(mylist)
Continued