Tam H. Doan
1 min readDec 22, 2019

--

This is a good solution to avoid memory leaks, but it has some drawbacks.

But when using this approach we have to check null each time we need access to View, which will introduce boilerplate code.

It’s also common source of NPE: we used this approach before and in one day, one of our dev forgot to check null before access to View, which leads to hundreds of app crashing (luckily it’s only happen in Beta release or the number of affected users will be millions).

--

--

Tam H. Doan
Tam H. Doan

Written by Tam H. Doan

Software Engineer, also a Writer and Runner

No responses yet