Starting Your Own Activity
To start an activity, we call startActivity()
on some Context
, typically on our Activity
or a Context
obtained from a View
.
To identify what activity to start, we pass an Intent
object to startActivity()
. When starting an activity from your own project, the particular type of Intent
that we will use is an “explicit” Intent
. This is where we identify the specific class that implements the activity that we want to start.
The explicit form of the Intent
constructor takes two parameters:
- A
Context
, typically the activity that is asking to start another activity - A Java
Class
object
That second parameter type means that in Kotlin, you will use ::class.java
, rather than just ::class
, to get to the proper object.
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.