amahi / android

Amahi Android App
GNU General Public License v3.0
164 stars 279 forks source link

Prevent Memory Leaks #739

Closed Prakhar-Agarwal-byte closed 3 years ago

Prakhar-Agarwal-byte commented 3 years ago

Describe the issue

Currently, in the codebase, there are some inner classes that are not static. Inner classes have an implicit reference to their parent activity which can, in some cases, cause memory leaks. To avoid memory leaks we should make inner classes static. This issue is related to #646

For example, we can change this

class NavigationDrawerViewHolder extends RecyclerView.ViewHolder { TextView titleShare; TextView titleShare; ImageView server_bubble;

to this

static class NavigationDrawerViewHolder extends RecyclerView.ViewHolder { TextView titleShare; TextView titleShare; ImageView server_bubble; ImageView server_bubble;