Java Static Variable becomes null [duplicate]

This generally would happen if the user lets the phone go to sleep and the system requires or clears memory. It’s best to keep information that you would require over a longer duration into a disk cache rather than just keeping it in a static variable. As you would know that the Android system has the final say on when to clear an app, only keep data that you would need for a very short interaction in a static variable.

Leave a Comment