10. You can do more with less. Express your ideas and reduce the amount of boilerplate
code.
Kotlin has many language features to help you avoid common programming mistakes
such as null pointer exceptions. Android apps that contain Kotlin code are 20% less
likely to crash.
Call Java-based code from Kotlin, or call Kotlin from Java-based code. Kotlin is 100%
interoperable with the Java programming language, so you can have as little or as
much of Kotlin in your project as you want.
Kotlin coroutines make asynchronous code as easy to work with as blocking code.
Coroutines dramatically simplify background task management for everything from
network calls to accessing local data.
Why Kotlin?
12. • An activity is a fundamental component of an app that represents a single,
focused screen with a user interface. Activities are used to interact with the
user and typically correspond to the various screens or windows the user
can interact with in an app.
• Activities can communicate with each other by passing data through intents.
Intents are a mechanism for sending messages between activities, which can
be used to start new activities or pass information between them.
Activities and Intents
14. package com.a2k.myapplication
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val intent = Intent(this, AnotherActivity::class.java)
startActivity(intent)
finish()
}
}
15. • Android views are the basic building blocks of the user interface (UI). They
are small rectangular boxes that respond to user inputs. Examples of views
include Text View, Edit Text, Button, Check Box, etc.
• View Group is an invisible container of other views and other View Groups.
Some of the view groups are Linear Layout, Constraint Layout, Relative
Layout, etc.
Android Views
16. • To share data between activities in Android, you can use an Intent. An
Intent is a messaging object that can launch a new Activity by passing it to
the startActivity() method. Intent can also carry data with various putExtra()
methods, in key-value pairs.
Sharing Data b/w Activities