Professional Documents
Culture Documents
WITH KOTLIN
‣ Kotlin in action
BASIC ANDROID DEVELOPMENT
Angga Raditya
BASIC ANDROID DEVELOPMENT
ANDROID STUDIO
https://developer.android.com/studio
Prerequisite
‣ Basic Kotlin
‣ You don’t need to install JDK because a copy of the latest OpenJDK comes
bundled with Android Studio 2.2 and higher, and this is the JDK version we
recommend you use for your Android projects.
BASIC ANDROID DEVELOPMENT
PROJECT STRUCTURE
LAYOUT
▸ Create new layout in your resource folder for layout
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Hello World!!" />
</RelativeL
BASIC ANDROID DEVELOPMENT
ACTIVITY
}
BASIC ANDROID DEVELOPMENT
ANDROID MANIFEST
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.enigma.tictactoe">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
BASIC ANDROID DEVELOPMENT
RESULT
TEXT
Angga
BASIC ANDROID DEVELOPMENT
EditText
When you press the
button the name input
will show on the
textView below
TEXT
...
implementation ‘com.google.android.material:material:1.1.0-rc02'
Add material dependencies at
implementation ‘de.hdodenhof:circleimageview:3.1.0' your gradle file
...
<resources>
...
</style>
</resources>
TEXT
WHAT IS MATERIAL
CONSTRAINT LAYOUT
TEXT
LETS MOVE TO
ANOTHER
ACTIVITY
Angga Raditya
TEXT
CREATE INTENT
TEXT
MAIN ACTIVITY
class MainActivity : AppCompatActivity() {
companion object{
val PLAYERS_NAME = "PLAYERS_NAME"
}
}
TEXT
SECOND ACTIVITY
INTENT
An Intent provides a facility for performing late runtime binding between the code
in different applications. Its most significant use is in the launching of activities,
where it can be thought of as the glue between activities. It is basically a passive
data structure holding an abstract description of an action to be performed.
MainActivity SecondActivity
Intent
SecondActivity
Extra 1
Extra n
startActivity()
TEXT
UNDERSTAND THE
ACTIVITY
Angga Raditya
TEXT
ANDROID ACTIVITY
class MainActivity : AppCompatActivity() {
companion object{ }
val PLAYERS_NAME = "PLAYERS_NAME"
}
}
TEXT
LETS START
MainActivity
Launched stratActivity() Back button pressed
destroyed!!
MORE EXPERIMENT
TEXT
Angga Raditya
TEXT