Skip to content Skip to sidebar Skip to footer

Android Intent's Resolveactivity And Package Manager

To check if an intent can be handled, you would call: if (intent.resolveActivity(getPackageManager()) != null) { // start activity } Question - why is the parameter to package m

Solution 1:

Package Manager is like a registry. it contains all details of application as given belowenter image description here

that's why you are providing package manager args to resolve intent before the fire. alternatively, you can also use chooser before firing intent.in other cases, you may want to retrieve different application info, then you can use a package manager. There is no obvious reason why we have to pass the argument. Perhaps only the Google developer that wrote the function could answer.

Post a Comment for "Android Intent's Resolveactivity And Package Manager"