onNewIntentIntent
onNewIntentIntent is not a standard Android API name. The correct callback name is onNewIntent(Intent), a method of the Android Activity class. This article describes that method and clarifies how it is used when an activity already exists.
onNewIntent(Intent) is a lifecycle callback that is invoked when an existing instance of an activity receives
onNewIntent(Intent) is typically triggered in scenarios involving activity launch modes or intent flags that route a
- If an activity is declared with launchMode="singleTop" and it is already at the top of the task
- If an activity uses launchMode="singleTask" or "singleInstance" and an existing task contains the activity, a new
Within onNewIntent(Intent), developers commonly:
- Call super.onNewIntent(intent) to preserve default behavior.
- Update the activity’s internal state based on the new intent data.
- Optionally call setIntent(intent) to replace the current intent returned by getIntent() with the latest one.
- Refresh UI components or pass the new intent to fragments or other components as needed.
onNewIntent does not create a new activity; it complements the standard lifecycle by providing a mechanism
Launch modes (standard, singleTop, singleTask, singleInstance), intent flags, and data transmission via extras or data URIs