Created
May 21, 2018 06:26
-
-
Save talhahasanzia/7d8a7d1444fc2f8901352b31e7fb92c4 to your computer and use it in GitHub Desktop.
Calculating LRU limit for different devices (as suggested by guide)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public LRUCalculator{ | |
public static int getMemorySize(Context context){ | |
int memClass = ( ( ActivityManager )context.getSystemService( Context.ACTIVITY_SERVICE ) ).getMemoryClass(); | |
int cacheSize = 1024 * 1024 * memClass / 8; | |
return cacheSize; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment