How can I give the user the opportunity to choose the application to open the link?
For example, the user has 3 browsers and sets Firefox as the default browser. I want to give the opportunity to open a link with Opera for the user when the user long presses the link.
Try using Intent.createChooser :
Uri uri = Uri.parse( "http://www.google.com" ); startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, uri), "Choose browser"));
PackageManager.queryIntentActivities () returns all actions that can handle a specific intent.
Using the Intent that you passed to it to now use it to start one of the actions in the returned list, you use Intent.setComponent with the ComponentName created from the package name and the name of the action you need in this list.
You can create a Uri with your URL and pass it into the intent as follows:
Uri uri = Uri.parse( "http://www.google.com" ); startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
Is this what you want to accomplish?