Android Intent suggest change

Implicit and Explicit Intents

An explicit intent is used for starting an activity or service within the same application package. In this case the name of the intended class is explicitly mentioned:

Intent intent = new Intent(this, MyComponent.class);
startActivity(intent);

However, an implicit intent is sent across the system for any application installed on the user’s device that can handle that intent. This is used to share information between different applications.

Intent intent = new Intent("com.stackoverflow.example.VIEW");

//We need to check to see if there is an application installed that can handle this intent
if (getPackageManager().resolveActivity(intent, 0) != null){ 
    startActivity(intent);
}else{
    //Handle error
}

More details on the differences can be found in the Android Developer docs here: Intent Resolution

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents