Android : Static variable null on low memory

  1. You can’t. Android needs to free up memory from time to time. Imagine if all applications had a ton of static data that is supposed to be resident forever – how would you fit that in memory? It’s a mobile phone. It doesn’t have virtual memory.

  2. (and 3): Anything that is intended to be persistent needs to be stored, either via SharedPreferences, a Sqlite database, or a file.

Leave a Comment