

Public class MainActivity extends AppCompatActivity void onCreate(Bundle savedInstanceState) Output of Android Implicit Intent Example Now open the main activity file MainActivity.java from \src\main\java\com\tutlane\ path and write the following code to open a new browser window on button click to load given url. In case if we create an Intent Filter for activity, there is a possibility for other apps to start our activity by sending a certain type of intent otherwise the activity can be started only by an explicit intent.įollowing is the simple code snippet of implicit intent in the android application. In android, an Intent Filter is an expression in the app’s manifest file and it is used to specify the type of intents that the component would like to receive. In case, if multiple intent filters are matched then the system displays a dialog so that the user can pick which app to use. If the matching component found, the system starts that component and sends it to the Intent object. In android when we create implicit intents, the android system will search for matching components by comparing the contents of intent with intent filters which defined in the manifest file of other apps on the device. Whenever the match found the system starts matching activity ( Activity B) by invoking the onCreate() method. The android system will search for an intent filter that matches the intent in all apps. If you observe the above image Activity A creates an intent with the required action and sends it to an android system using the startActivity() method. For example, by using implicit intents we can request another app to show the location details of the user or etc.įollowing is the pictorial representation of how Implicit intents send a request to the android system to start another activity.


In android, Implicit Intents won’t specify any name of the component to start instead, it declare an action to perform and it allows a component from other apps to handle it.
