A brief introduction to Kotlin

Slides:



Advertisements
Similar presentations
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Advertisements

1 GWT Google Web Toolkit Build AJAX apps in the Java language
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Groovy & Grails Jean Barmash CTO, EnergyScoreCards.com
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to AppInventor Dr. José M. Reyes Álamo.
UNIT4 BUSINESS ANALYTICS. page WHAT IS THE PRODUCT? 2 A business intelligence tool kit, specializing in Coporate Performance Management An application.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Android Development (Basics)
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Android Fragments A very brief introduction Android Fragments1.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Android and Eclipse Thaddeus Diamond CPSC 112. A Quick Introduction Eclipse is an IDE (Integrated Development Environment Open Source Much more full-featured.
Programming Your Android App Gourav Khadge
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
Module 1: Introduction to C# Module 2: Variables and Data Types
Prerequisites Android Studio – io.html io.html Java.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Introduction to Android
Web Development & Design Foundations with XHTML Chapter 11 Key Concepts.
Understanding JavaScript and Coding Essentials Lesson 8.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Android apps development - Eclipse, Android SDK, and ADT plugin Introduction of.
QML and JavaScript for Native App Development Michael Tims Jen Trieu.
Introduction to Android Programming
Introduction to Android Chapter 1 1. Objectives Understand what Android is Learn the differences between Java and Android Java Examine the Android project.
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
CIS 234: Object-Oriented Programming with Java
PhoneGap, Processing.
Basic Concepts: computer, program, programming …
CS240: Advanced Programming Concepts
Introduction to Computer CC111
CSCI-235 Micro-Computer Applications
Android Moving to a second Activity
A very brief introduction
Designing a DSL in KOTLIN
Section 17.1 Section 17.2 Add an audio file using HTML
Development-Introduction
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
CMPE419 Mobile Application Development
Trainings 11/4 Intro to Java.
Assembler, Compiler, Interpreter
DHTML Javascript Internet Technology.
آشنایی با جاوا Introduction to Java
A quick introduction.
Programming Vocabulary.
Optical Character Recognition
DHTML Javascript Internet Technology.
Introduction to Scala Unit 2
Android Developer Fundamentals V2 Lesson 1
statically-typed JVM-targeted programming language
CS105 Introduction to Computer Concepts
CHAPTER 1 Introduction Chapter objectives: Understand what Android is
Assembler, Compiler, Interpreter
Introduction to AppInventor
Tutorial 10: Programming with javascript
A very brief introduction
CSC 581: Mobile App Development
Kotlin vs Java Will the Emerging Player Beat the Veteran?
CMPE419 Mobile Application Development
C# and ASP.NET Programming
Popular Programming Languages for Mobile Apps In recent years, Mobile App development industry has gained huge popularity as more and more people are.
Presentation transcript:

A brief introduction to Kotlin Kotlin and Android A brief introduction to Kotlin Kotlin and Android

Kotlin, vs Java 1995, Sun Microsystems (now Oracle) Object-oriented Statically typed Inspired by C++ Large island in Indonesia 139.000 km^2 145.000.000 inhabitants 2016, JetBrains (Android Studio, ReSharper, etc.) Object-oriented Statically typed Inspired by Scala Small island near Saint Petersburg, Russia 15 km^2 43.000 inhabitants Kotlin and Android

Kotlin programming language, design goals Concise: Reduce the amount of code Safe No more NullPointerExceptions Val name = data?.getStringExtra(NAME) Example: KotlinPersonalInfo -> MainActivity Interoperable Use existing libraries for JVM (like Android API) Compile to JVM or JavaScript Tool-friendly Support for the programmer using editors (like Android Studio) Kotlin and Android

Kotlin, a little syntax Semicolons are optional Adding a new-line is generally enough Variables and constants var name = ”Anders” // variable Var means ”variable” val name2 = ”Anders” // read-only (constant) Val means ”value” Types are not specified explicity by the programmer Types are infered by the compiler Examples KotlinCollectWords, Calculator, Personal Information Kotlin and Android

Kotlin, and Android 2017 Google supports Kotlin as a programming language for the Android platform Kotlin or Java For each Activity you use either Java or Kotlin XML layout files are still used Kotlin and Android

Kotlin: Android, no more findVievById(…) Import kotlinx.android.synthetic.main.activity_main.* activity_main.xml is the name of the layout file var word = mainWordEditText.text mainWordEditText is the id from the layout file mainClearWordsButton.setOnClickListener { /*do something*/ } mainClearWordsButton is the id from the layout file Example KotlinCollectWords Kotlin and Android

Kotlin: Android event handlers onClick in layout XML file Does not work Assign an id to the Button in the layout XML file mainClearWordsButton.setOnClickListener { /*do something*/ } mainClearWordsButton is the id from the layout file Kotlin and Android

Kotlin support in Android Studio Kotlin + Android Studio both made by JetBrains Great support for Kotlin in Android Studio New project Choose if you want to add support for Kotlin New Activity Choose if you want Java or Kotlin (scroll down) Convert existing Java code to Kotlin Code -> Convert Java File to Kotlin Add Kotlin to an existing project (without support for Kotlin) Kotlin and Android

Anko library Library to build Android UI in Kotlin And a lot more https://github.com/Kotlin/anko Kotlin and Android