Why is startActivity() wrapped in try/catch in this lab?

  1. To log the URL
  2. To avoid a crash (ActivityNotFoundException) if no app can handle the intent
  3. To speed up the app
  4. To ask for permissions
Answer

B) To avoid a crash (ActivityNotFoundException) if no app can handle the intent

Catching the exception lets the app show a friendly message instead of crashing.

Computer Science MCQ · More Lab: Implicit Intents – Browser and Dialer MCQs · Practise