Share
Embed
Kotlin for Android
Kotlin for Android is now officially supported by Google, in this presentation we explore some of the cool features of the language. Also, we take some time to introduce new-comers to Android Development.
Jorge E. Hernández
June 26, 2018
Transcript
182 slides
-
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <school> <student />
</school> // school_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan”/>
</school> // school_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan”
last_name=“Perez”/> </school> // school_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan”
last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan”
last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml <?xml version="1.0" encoding="utf-8"?> <library> </library> // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:=““> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=““> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=“http://example.com/schema/myschool“> <student name=“Juan” last_name=“Perez”/> <classroom name=“VIP Classroom”/> <teacher name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library> <book name=“Fifty
shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=“http://example.com/schema/myschool“> <student s:name=“Juan” s:last_name=“Perez”/> <classroom s:name=“VIP Classroom”/> <teacher s:name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library xmlns:l=“http://example.com/schema/mylibrary“> <book
name=“Fifty shades of Grey”/> <student name=“José García”/> <author name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=“http://example.com/schema/myschool“> <student s:name=“Juan” s:last_name=“Perez”/> <classroom s:name=“VIP Classroom”/> <teacher s:name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library xmlns:l=“http://example.com/schema/mylibrary“> <book
l:name=“Fifty shades of Grey”/> <student l:name=“José García”/> <author l:name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=“http://example.com/schema/myschool“> <student s:name=“Juan” s:last_name=“Perez”/> <classroom s:name=“VIP Classroom”/> <teacher s:name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library xmlns:miau=“http://example.com/schema/mylibrary“> <book
miau:name=“Fifty shades of Grey”/> <student miau:name=“José García”/> <author miau:name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:guau=“http://example.com/schema/myschool“> <student guau:name=“Juan” guau:last_name=“Perez”/> <classroom guau:name=“VIP Classroom”/> <teacher guau:name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <library xmlns:l=“http://example.com/schema/mylibrary“> <book
l:name=“Fifty shades of Grey”/> <student l:name=“José García”/> <author l:name=“E. L. James”/> </library> <?xml version="1.0" encoding="utf-8"?> <school xmlns:s=“http://example.com/schema/myschool“> <student s:name=“Juan” s:last_name=“Perez”/> <classroom s:name=“VIP Classroom”/> <teacher s:name=“El Barco”/> </school> // school_file.xml // library_file.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent">
</android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!"/> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> // my_screen.xml -
A 5 minutes introduction // my_screen.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction Android Tests: - Clicks (taps) -
Swipes - Pinch (zoom) Instrumentation tests “Espresso” -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen>
<dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click
me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me" app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color> <color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color> <color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color> <color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height="wrap_content" android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name=“btn_height">100dp</dimen> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text="Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text=“Click me"
app:layout_constraintBottom_toTopOf="@+id/myTextView" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text=“@string/btn_text“ app:layout_constraintBottom_toTopOf="@+id/myTextView"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text=“@string/btn_text“ app:layout_constraintBottom_toTopOf="@+id/myTextView"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=“@string/hello“ android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click me</string> <string name=“hello">Hello World!</string> </resources> -
A 5 minutes introduction <Button android:id="@+id/myButton" android:layout_width=“@dimen/btn_width" android:layout_height=“@dimen/btn_height” android:text=“@string/btn_text“ app:layout_constraintBottom_toTopOf="@+id/myTextView"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=“@string/hello“ android:textColor=“@color/red" android:textSize="56sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" /> -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> colors.xml -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> colors.xml public final class R { public static final class color { }} }} -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> colors.xml public final class R { public static final class color { }} }} -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> colors.xml public final class R { public static final class color { public static final int red=0x7f050002; public static final int green=0x7f050003; public static final int blue=0x7f050004; }} }} -
A 5 minutes introduction <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#FF0000</color>
<color name="green">#00FF00</color> <color name="blue">#0000FF</color> </resources> colors.xml R.color.red R.color.green R.color.blue public final class R { public static final class color { public static final int red=0x7f050002; public static final int green=0x7f050003; public static final int blue=0x7f050004; }} }} -
A 5 minutes introduction dimens.xml <?xml version="1.0" encoding="utf-8"?> <resources> <dimen
name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction dimens.xml public final class R {
public static final class dimen { public static final int btn_width=0x7f030004; public static final int btn_height=0x7f050002; }} }} <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction dimens.xml R.dimen.btn_width R.dimen.btn_height public final class
R { public static final class dimen { public static final int btn_width=0x7f030004; public static final int btn_height=0x7f050002; }} }} <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="btn_width">180dp</dimen> <dimen name="btn_height">100dp</dimen> </resources> -
A 5 minutes introduction strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string
name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string
name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> public final class R { public static final class string { public static final int btn_text=0x7f05001e; public static final int hello=0x7f050030; }} }} -
A 5 minutes introduction strings.xml R.string.btn_text R.string.hello public final class
R { public static final class string { public static final int btn_text=0x7f05001e; public static final int hello=0x7f050030; }} }} <?xml version="1.0" encoding="utf-8"?> <resources> <string name="btn_text">Click me</string> <string name="hello">Hello World!</string> </resources> -
A 5 minutes introduction my_screen.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction my_screen.xml public final class R {
public static final class layout { public static final int my_screen=0x7f64003e; }} }} <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction my_screen.xml R.layout.my_screen public final class R
{ public static final class layout { public static final int my_screen=0x7f64003e; }} }} <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction my_screen.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction my_screen.xml public final class R {
public static final class id { public static final int myButton=0x7f64003e; public static final int myTextView=0x7f64003e; }} }} <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction my_screen.xml R.id.myButton R.id.myTextView public final class
R { public static final class id { public static final int myButton=0x7f64003e; public static final int myTextView=0x7f64003e; }} }} <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <Button android:id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/myTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </android.support.constraint.ConstraintLayout> -
A 5 minutes introduction import android.app.Activity class MyActivity : Activity()
{{ override fun onCreate() { }} }} -
A 5 minutes introduction import android.app.Activity class MyActivity : Activity()
{{ override fun onCreate(savedInstanceState: Bundle?) { }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() {{ override fun onCreate(savedInstanceState: Bundle?) { }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() {{ override fun onCreate(savedInstanceState: Bundle?) { super.onCreate() }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() {{ override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() {{ override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView() }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate() { }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate() { }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} import android.app.Activity import android.os.Bundle public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_screen); }} }} MainActivity.kt MainActivity.java -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById() }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>() }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton) }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if () { }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if () { // Hide }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if () { // Hide } else { // Show }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>()) { // Hide } else { // Show }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView)) { // Hide } else { // Show }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE) { // Hide } else { // Show }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE) { findViewById<View>(R.id.myTextView).visibility = View.INVISIBLE } else { // Show }} }} }} }} MainActivity.kt -
A 5 minutes introduction import android.app.Activity import android.os.Bundle class MyActivity
: Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.my_screen) findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE) { findViewById<View>(R.id.myTextView).visibility = View.INVISIBLE } else { findViewById<View>(R.id.myTextView).visibility = View.VISIBLE }} }} }} }} MainActivity.kt -
A 5 minutes introduction findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE)
{ findViewById<View>(R.id.myTextView).visibility = View.INVISIBLE } else { findViewById<View>(R.id.myTextView).visibility = View.VISIBLE }} }} MainActivity.kt findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (findViewById(R.id.myTextView).getVisibility() == View.VISIBLE) { findViewById(R.id.myTextView).setVisibility(View.INVISIBLE); } else { findViewById(R.id.myTextView).setVisibility(View.VISIBLE); }} }} }); MainActivity.java -
A 5 minutes introduction findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE)
{ findViewById<View>(R.id.myTextView).visibility = View.INVISIBLE } else { findViewById<View>(R.id.myTextView).visibility = View.VISIBLE }} }} MainActivity.kt findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (findViewById(R.id.myTextView).getVisibility() == View.VISIBLE) { findViewById(R.id.myTextView).setVisibility(View.INVISIBLE); } else { findViewById(R.id.myTextView).setVisibility(View.VISIBLE); }} }} }); MainActivity.java -
A 5 minutes introduction findViewById<View>(R.id.myButton).setOnClickListener { if (findViewById<View>(R.id.myTextView).visibility == View.VISIBLE)
{ findViewById<View>(R.id.myTextView).visibility = View.INVISIBLE } else { findViewById<View>(R.id.myTextView).visibility = View.VISIBLE }} }} MainActivity.kt findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (findViewById(R.id.myTextView).getVisibility() == View.VISIBLE) { findViewById(R.id.myTextView).setVisibility(View.INVISIBLE); } else { findViewById(R.id.myTextView).setVisibility(View.VISIBLE); }} }} }); MainActivity.java -
Kotlin Appeared in 2011 Created by JetBrains JetBrains develops IntelliJ,
PyCharm, WebStorm Runs on the JVM •Clojure •Groovy •JRuby •Jython •Scala Officially supported by Google -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { }}
public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello() { return "" }} }} public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello(name: String) { return "" }} }} public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello(name: String): String { return "" }} }} public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello(name: String): String { return "Hello !" }} }} public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello(name: String): String { return "Hello $name!" }} }} public class MyClass { }} -
A 5 minutes introduction MyClass.java MyClass.kt class MyClass { fun
sayHello(name: String): String { return "Hello $name!" }} }} public class MyClass { public String sayHello(String name) { return "Hello " + name + "!"; }} }} -
A 5 minutes introduction MyClass.java MyClass.kt fun circleArea(radius: Double): Double
{ val PI = 3.1416 return PI * Math.pow(radius, 2.0) / 2 }} public double circleArea(double radius) { double PI = 3.1416; return (PI * Math.pow(radius, 2.0)) / 2; }} -
A 5 minutes introduction MyClass.java MyClass.kt fun circleArea(radius: Double): Double
{ var PI = 3.1416 return PI * Math.pow(radius, 2.0) / 2 }} public double circleArea(double radius) { double PI = 3.1416; return (PI * Math.pow(radius, 2.0)) / 2; }} -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java fun concatName(name: String, last: String): String {
return "$name $last" }} MyClass.java MyClass.kt public String concatName(String name, String last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} -
Kotlin vs Java fun concatName(name: String?, last: String?): String? {
return "$name $last" }} MyClass.java MyClass.kt public String concatName(String name, String last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} -
Kotlin vs Java fun concatName(name: String!, last: String!): String? {
return "$name $last" }} MyClass.java MyClass.kt public String concatName(String name, String last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java MyClass.java MyClass.kt public String concatName(String name, String
last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} class MyClass { fun sayHello(name: String, last: String): String { MyClass obj = MyClass() return "Hello ${obj.concat(name)}!” }} }} -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java Extensions.kt fun String.appendA(): String { return this.plus("A")
} AnyClass.kt fun useExtensionFunction(anyString: String): String { return anyString.appendA() } -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
A 5 minutes introduction MyClass.java MyClass.kt fun handleString(text: Any): String?
{ if (text is String) { return "$text other value" } else { return null } } public String handleString(Object text) { if (text instanceof String) { return ((String) text).concat(" other value"); } else { return null; } } -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java fun concatName(name: String, last: String): String {
return "$name $last" }} MyClass.java MyClass.kt public String concatName(String name, String last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} -
Kotlin vs Java fun concatName(name: String, last: String): String {
return "$name $last" }} MyClass.java MyClass.kt public String concatName(String name, String last) { if (name != null && last != null) { return name.concat(" ").concat(last); } else { return null; }} }} -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java Address.kt val address : Address = Address()
address.state = "bar" address.street = "bar" address.city = "bar" address.zip = "bar" class Address { var name: String = "foo" var street: String = "foo" var city: String = "foo" var state: String = "foo" var zip: String = "foo" } -
Kotlin vs Java Address.kt val what = address.state class Address
{ val name: String = "foo" val street: String = "foo" val city: String = "foo" val state: String = "foo" val zip: String = "foo" } // read only -
Kotlin vs Java public class Address { String state; String
street; String city; String zip; public String getState() { return state; } public void setState(String state) { this.state = state; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } } -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions -
Kotlin vs Java val age = 13 val name =
"Elon" val girls: Int = 7 val place: String = "Home" MyClass.kt -
Kotlin vs Java val age = 13 val name =
"Elon" val girls: Int = 7 val place: String = "Home" int age = 13; String name = "Elon"; MyClass.kt MyClass.java -
Kotlin vs Java Null safe Interoperable with Java Extension functions
Smart casts String templates Properties (getter/setters in Java) Type inference Data classes Range expressions