applicationStructure.8
applicationStructure.8
1/1 2/22
3/22 4/22
5/22 6/22
7/22 8/22
The Manifest Example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
</manifest>
9/22 10/22
11/22 12/22
I Message objects for requesting actions I To start an activity: used for passing the information and for
receiving the result, if any
I An intent carries:
I To start a service or bind to it
• Required action
• Additional information I To deliver a broadcast
13/22 14/22
15/22 16/22
Starting an Activity Recovering the Information
I Simplest form:
val intent = Intent(this, GameActivity::class.java)
startActivity(intent)
I In GameActivity:
companion object {
const val NUMBER_OF_COLORS = "NUMBER_OF_COLORS"
// ... other constants
}
17/22 18/22
I Implicit Intents declare the action that must be carried out I If necessary, additional information can be added with
putExtra:
I The data attribute contains the URI to which the action is
targeted val intent = Intent(Intent.ACTION_SEND).apply {
type = "*/*" // mime type
val phoneNumber = "666777888" putExtra(Intent.EXTRA_EMAIL, addresses)
val intent = Intent(Intent.ACTION_DIAL).apply { putExtra(Intent.EXTRA_SUBJECT, subject)
data = Uri.parse("tel:$phoneNumber") putExtra(Intent.EXTRA_STREAM, attachment)
} }
19/22 20/22
21/22 22/22