question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion] Using this library together with WebViews

See original GitHub issue

It seems like a lot of people try to use this library together with WebViews in order to implement custom web browsers. However, it seems to be non-trivial to properly use WebView’s together with the library’s recycling mechanism that reuses previously inflated views to display the contents of different tabs when they are not visible anymore. The following issues are related to this problem:

I don’t have enough experience with the WebView class to give good advices on this issue. I even hadn’t WebViews in mind when I implemented this library. Therefore this issue is meant to be a platform for discussing this problem. It would be great, if those that are interested in using this library together with WebView’s could share their experiences here. Even better, if someone would create a simple example project at Github different people would be able to enhance it, which will hopefully result in a satisfying solution to be used by everyone. I will do my best to comment on issues and give advices about how to use this library properly.

I think that the recycling mechanism of the library works great as it is and there is no need to add any workarounds to get it to work together with WebView’s. Of course there is a chance that there might be any bugs related to it. If that’s the case, I will do my best to fix them.

In my opinion the following things must be tackled:

  • It is necessary to save the state of a WebView in memory or on the local storage. This includes the visited URL, the history and the content of the displayed website.
  • If the WebView class does not provide a suitable way to store/restore its full state out of the box, it is necessary to implement this by ourselves.
  • For displaying the previews of tabs it might be helpful to display a “screenshot” of the website rather than actually using the WebView to render the website.
  • Frequently reloading the URL of the WebView is no option as this will result in a bad user experience due to the fact that network requests are time consuming.

I hope that some people will contribute to this issue and share their opinions and experiences in order to solve this problem.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
anandmaheshcommented, Jul 28, 2018

Yes, I am interested in creating a sample project to demonstrate the working of web views with this library and thanks for a brief overview of classes and mechanism. Give me some time, I will get back to you after creating a demo project.

0reactions
z4zzamancommented, Feb 12, 2019

Hey, I 'm using this library in my project with webview but have blinking issue as well as layout inflate issue. Basically I couldn’t use webview in my main activity layout. I am to use switcher view in my main layout then inflate my desired view using onFlateView() method of Decorator class where I also have a frame layout and for every new Tab I create a object of Webview and attach this webview in frame layout.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native WebView: A complete guide - LogRocket Blog
React Native WebView renders web content in a native view. Learn some of its tricks and features that you can use to your...
Read more >
Diving Deep into WebViews | Kodeco, the new raywenderlich ...
Learn how to handle webpages in your Flutter application using WebViews.
Read more >
Adding WebView to your Flutter app - Google Codelabs
In this codelab, you'll build a mobile app step by step featuring a WebView using the Flutter SDK. Your app will: Display web...
Read more >
InAppWebView: the real power of WebViews in Flutter
It's a Flutter plugin that allows you to incorporate WebView widgets into your Flutter app, to use headless WebViews or to use in-app ......
Read more >
Please provide an Android library that implements a WebView ...
My prototype uses AwContents, which isn't intended to be used for embedding Chromium, but has the advantage that it sort-of works, together with ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found