January 2018
Intermediate to advanced
434 pages
14h 1m
English
Intents are one of the most common components used in Android apps. They can be thought of as a messenger used to transfer messages between different Android components. For example, you send an intent when you need to start an activity, you send an intent when you need to start a service. To launch an activity in Android, you are first needed to create an intent and then pass it to the startActivity method. In the following example, we will try to launch an activity with some data and flags:
val intent = Intent(this, SomeActivity::class.java) intent.putExtra("data", 5) intent.setFlag(Intent.FLAG_ACTIVITY_SINGLE_TOP) startActivity(intent)
Also, you can assume an extra line for all data that you pass with the intent. ...
Read now
Unlock full access