In my opinion, it is better to let the user select which browser to use when opening a webpage or a link.
You can broadcast an intent(with the link that you want it to go to) like so:
String url = "";//your url
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
Sources: Link1, Link2
Answering your question though, I think it is possible. I did some quick reasearch and I saw this answer. This answer is shorter but might fullfill your needs. Basically, you will create an intent like so:
Intent intent = getPackageManager()
.getLaunchIntentForPackage("browser.package.name");
String url = "";//your url
intent.setData(Uri.parse(url));
startActivity(intent);
For the package names, firefox package name is:
org.mozilla.firefox
I got this from their Google Play page
Google Chrome's package name is:
com.android.chrome
Also from their Google Play page
Bonus: Opera Mini :D
com.opera.mini.android
From their Google Play page
For the default android Browser:
com.google.android.browser or com.android.browser
I got this from this answer.
Now before launching your intent, we must do a little checking if the browser is installed. We can do this like so: (I based this on from here too)
public void launchABrowserForUrl(String url) {
PackageManager packageManager = getPackageManager();
// Might be better declared as constants somewhere safer,
// But for the sake of simplicty, declared here
String[] browserPackageNames = {
"org.mozilla.firefox",
"com.android.chrome",
"com.google.android.browser",
"com.android.browser"
}
for (int i = 0; i < browserPackageNames.length; i++) {
Intent intent = getPackageManager()
.getLaunchIntentForPackage(browserPackageNames[i]);
List<ResolveInfo> appsThatCanLaunchThisIntent = packageManager
.queryIntentActivities(intent, 0);
if (appsThatCanLaunchThisIntent.size() > 0) {
intent.setData(Uri.parse(url));
startActivity(intent);
return;
}
}
// Code reached here, meaning for some reason no browser was detected
// Pop an error message or something
}