How to bury your app quickly without any suspicion …

Just imagine that you want to write a single-window app to write some text and highlight addresses from it. It’s easy.

Ok, we make it via regexp, some third-party or internal methods/libraries, Spannable and blah blah blah .. But stop!

Then you accidentally open Android monitor and see five active threads in main process of your App!


and what’s going on here? The answer is simple. It’s because you use the static Android method WebView.findAddress() . Ok, but it’s static … And you don’t understand how such kind of usage of WebView can produce so many troubles for you. It’s easy understand because Android 4.4 (API level 19) introduces a new version of WebView that is based on Chromium. And if you dig into it and look at sources you will see that this static method creates instances of all this stuff via WebViewFactoryProvider.

I just recommend to rid of any usage of WebView in main process and create a separate process like :web/:browser for such things (for instance to display a web url).

The sort story above it’s just a showcase how harmless things are able to produce big problems.

gl & hf guys (:

Like what you read? Give \n Malyshev Yegor \n a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.