Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with Android and Kotlin

Getting Started with Android and Kotlin

GDG Kolkata August 2017, workshop on Getting Started woth Android and Kotlin.

Rivu Chakraborty

August 19, 2017
Tweet

More Decks by Rivu Chakraborty

Other Decks in Technology

Transcript

  1. Getting Started with Android and Kotlin By Rivu Chakraborty &

    GDG Kolkata Team http://rivuchk.com/kotlin-slide
  2. Rivu Chakraborty Sr. Software Engineer (Android) - MaxMobility Pvt. Ltd.

    Member - Google Developer Group Kolkata Founder - Kotlin Kolkata Developer Group Technical Tutorials Writer @ AndroidHive, Java Code Geeks http://www.rivuchk.com
  3. What is Kotlin Before starting with Android Development with Kotlin,

    we need to know the Kotlin language 1st Kotlin is a Statically typed programming language. Kotlin is multiplatform i.e. it runs on JVM, it can be compiled to JavaScript Source code as well as can be used as LLVM backend. Kotlin provides great features and flexibility which enables you to write powerful yet short programs.
  4. Understanding the language We will first write codes for terminal

    to understand the language idioms and features properly, gradually we will move to using Kotlin with Android. P.S. Kotlin has really a huge number of features, here we will focus on most important ones from an Android Developer’s point of view.
  5. Variables and Data types • var for variables that may

    change value, val for final variables • Do we really need to declare Datatype explicitly? • Unit and Any • Explicit type casting • Pair val myInt:Int = 15 val name = “Rivu” var myLong:Long = myInt.toLong() var (name,age) = Pair(“Indranil”,24)
  6. Bye bye NullPointerException! • Nallable and Non-nullable variables • If

    not null shorthand • Null check and execute statements • let operator • Nullable boolean • Revisit variables - lazy and lateinit and their use
  7. Functions are finally enjoyable • Return types and Parameters •

    Default value • Named arguments • Local functions • Generic functions • Tail recursion made easy tailrec fun isPrime(n:Int =1, div:Int = (n/2)):Boolean = if (div<=1) true else if (n%div == 0) false else isPrime(n,div-1)
  8. Class, Interface, Object and Singleton • Constructor • init •

    Multiple constructors • Diff between init and constructors • Open class • Extension function • Singletons made easy • Data classes • Interfaces • Delegates
  9. Kotlin and Android (Workshop) • Starting Android Project with Kotlin

    (both on Android Studio 2.x and 3) • Simple Hello World with Kotlin • Kotlin Android extension - Say goodbye to butterknife • Anko Library (Commons, Layouts) • Hands on Coding - Notes App