简体   繁体   中英

How to create a custom browser in android

Hi i am having a activity with a button, on click of the button it has to load a custom browser in a new activity not the default browser of android. and i need a way to exclude the history of the browser such that on back press it comes back to the previous activity without navigating to previous website. I am new to android and any ways to do this

You are probably just talking about the WebView

Link to the official tutorial

Note :

This onKeyDown(int, KeyEvent) callback method will be called anytime a button is pressed while in the Activity. The condition inside uses the KeyEvent to check whether the key pressed is the BACK button and whether the WebView is actually capable of navigating back (if it has a history). If both are true, then the goBack() method is called, which will navigate back one step in the WebView history.Returning true indicates that the event has been handled. If this condition is not met, then the event is sent back to the system.

您可以首先在活动中放置一个WebView

If you want to have a view which can browse the web in your app then make use of the WebView view.

Else if you want to create your own custom browser, then you have to make use Web engine WebKit present in the library layer of the android.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM