简体   繁体   中英

How can I update the loadUrl of a WebView from another class

I've create a WebView in the main class of an activity, then I've a new class but I can't modify any property of the webView created in the main class, what are the steps for the proper update?

Thanks.

In this situation i would probably create an interface. Then in the class that extends WebView or whatnot, you could call loadUrl from the interface. Then from another class you could call the interface method inside of the class that extends WebView. If you need an example let me know and i can provide one.

More on interfaces:

Oracle Documentation on Interfaces
Oracle Documentation on how to implement intefaces

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