Android Application Development (AND-401) — Question 61
Which method should you use to start a sub-activity?
Answer options
- A. startActivity(Intent intent)
- B. startActivityForResult(Intent intent , int requestCode)
- C. startService(Intent intent)
- D. startSubActivity(Intent intent)
Correct answer: B
Explanation
The correct method to begin a sub-activity is startActivityForResult(Intent intent, int requestCode), as it allows for the parent activity to receive a result back from the sub-activity. The other options, such as startActivity and startService, do not facilitate this two-way communication, while startSubActivity is not a valid method in Android development.