I am unsure about the purpose of the resolveActivity
method in the Intent
class, based on the docs the resolveActivity
method "returns the Activity component that should be used to handle this intent"
Since my Intent
instance has Intent.ACTION_VIEW
as it's parameter, the getAction() is non null and the intent
must be handled by the Activity
. I don't see the purpose in using actionView.resolveActivity(packageManager)
.
val actionView = Intent(Intent.ACTION_VIEW, currentUri) //Creation of the Intent Object
actionView.resolveActivity(packageManager)?.run { //Checking if the resolveActivity instance is null
...}