Android calls the system's default browser access method
1. Start the android default browser
In this way, android can call the default browser of the mobile phone to access.
2. Specify the corresponding browser to access
1. Specify the browser that comes with android to access
( “com.android.browser”:packagename ;“com.android.browser.BrowserActivity”:启动主activity) Intent intent= new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse(""); intent.setData(content_url); intent.setClassName("com.android.browser","com.android.browser.BrowserActivity"); startActivity(intent);
2. Start other browsers ( Of course, the browser must be installed on the machine)
Just modify the following corresponding packagename and main startup activity to call other browsers
intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
uc browser":"com.uc.browser", "com.uc.browser.ActivityUpdate"
opera:"com. opera.mini.android", "com.opera.mini.android.Browser"
qq browser:"com.tencent.mtt", "com.tencent.mtt.MainActivity"
3. Open a local html file
When opening a local html file, you must specify a browser instead of using method one to browse. The specific sample code is as follows
Intent intent= new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("content://com.android.htmlfileprovider/sdcard/help.html"); intent.setData(content_url); intent.setClassName("com.android.browser","com.android.browser.BrowserActivity"); startActivity(intent);
The key point is to call the "content" filter.
Friends who have programmed in win32 before may wonder whether it is possible to use this form of "file://sccard/help.html". I can tell you with certainty that the default browser settings do not parse "file". If you want your default android browser to have this function, you need to modify the manifest.xml file in the android source code, and then compile it yourself. The browser code generates the corresponding apk package to reinstall on the machine.
The general steps are as follows:
1. Open the packages/apps/Browser/AndroidManifest.xml file and add it to the corresponding.
<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="file" /> </intent-filter>
2. Recompile, package and install. In this way, the new browser will support the form of "file"
If you are interested, you can try it
The above content is the method introduced by the editor to access the default browser of the Android system. I hope it will be helpful to everyone! Please pay attention to the PHP Chinese website for related articles on the method of calling the default browser of the Android system!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This article analyzes the top four JavaScript frameworks (React, Angular, Vue, Svelte) in 2025, comparing their performance, scalability, and future prospects. While all remain dominant due to strong communities and ecosystems, their relative popul

This article addresses the CVE-2022-1471 vulnerability in SnakeYAML, a critical flaw allowing remote code execution. It details how upgrading Spring Boot applications to SnakeYAML 1.33 or later mitigates this risk, emphasizing that dependency updat

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

Node.js 20 significantly enhances performance via V8 engine improvements, notably faster garbage collection and I/O. New features include better WebAssembly support and refined debugging tools, boosting developer productivity and application speed.

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

Iceberg, an open table format for large analytical datasets, improves data lake performance and scalability. It addresses limitations of Parquet/ORC through internal metadata management, enabling efficient schema evolution, time travel, concurrent w

This article explores methods for sharing data between Cucumber steps, comparing scenario context, global variables, argument passing, and data structures. It emphasizes best practices for maintainability, including concise context use, descriptive

This article explores integrating functional programming into Java using lambda expressions, Streams API, method references, and Optional. It highlights benefits like improved code readability and maintainability through conciseness and immutability
