1. Start the default android browser
In this way, android can call the phone's default browser to access.
2. Specify the corresponding browser to access
1. Specify the browser access that comes with Android
( “”:packagename ;“”:Start the mainactivity) Intent intent= new Intent(); (""); Uri content_url = (""); (content_url); ("",""); startActivity(intent);
2. Start other browsers (of course, this browser must be installed on the machine)
Just modify the following corresponding packagename and main startup activity to call other browsers
("","");
uc browser ":"", ""
opera :"", ""
qq browser: "", ""
3. Open the local html file
When opening a local html file, you must specify a browser, and you cannot browse it in the way. The specific example code is as follows
Intent intent= new Intent(); (""); Uri content_url = ("content:///sdcard/"); (content_url); ("",""); startActivity(intent);
The key point is to call the "content" filter.
If you have programmed on win32 in the past, you may think that using this form of "file://sccard/" is OK, you can tell you with certainty that the default browser settings do not parse the "file". If you want your default android browser to have this function, you need to modify the file by yourself, and then compile the browser code yourself to generate the corresponding apk package to install it again on the machine.
The general steps are as follows:
1. Open the packages/apps/Browser/ file and add it to the corresponding <intent-filter>
<intent-filter> <action android:name="" /> <category android:name="" /> <category android:name="" /> <data android:scheme="file" /> </intent-filter>
2. Recompile, package and install, so that the new browser supports the "file" form
If you are interested, you can try it.
The above content is the method of accessing Android calling the default browser of the Android system introduced to you. I hope it will be helpful to everyone!