Android LruCache : how to put and get user's data
2017-10-02 19:31
513 查看
package zhangphil.cache; import android.graphics.Bitmap; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.util.LruCache; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int CACHE_SIZE = 8 * 1024 * 1024; LruCache<String, Bitmap> mLruCache = new LruCache(CACHE_SIZE); int count = 5; String key; Bitmap bmp; for (int i = 0; i < count; i++) { key = String.valueOf(i); bmp = Bitmap.createBitmap(i + 1, i + 2, Bitmap.Config.ARGB_8888); mLruCache.put(key, bmp); } for (int i = 0; i < count; i++) { key = String.valueOf(i); bmp = mLruCache.get(key); Log.d("key:" + key, "value:" + bmp.getWidth() + "," + bmp.getHeight()); } } }
相关文章推荐
- Android LruCache : how to put and get user's data
- How to use 'SetItemData()' and 'GetItemData()'?
- Android: How to get a custom View's height and width? [duplicate]
- [Android] how to get pem format public key from modulus and exponent
- How To determine DDIC Check Table, Domain and Get Table Field Text Data For Value?
- How To determine DDIC Check Table, Domain and Get Table Field Text Data For Value?
- How to use 'SetItemData()' and 'GetItemData()'?
- How to get the Diagnostic data and debug file of Sales Order pick release
- Android Build System ---- how to add your product and board config *.mk
- Kernel.org hacked – how to get Android repo?
- Discover Feature Engineering, How to Engineer Features and How to Get Good at It
- How to get response content with specified post data by post method
- How to get Json in Android
- How to Build and Use libnetfilter_queue for Android
- How to download Xcode 4 / 5 / 6 / 7 and get the DMG file?
- copy_to_user,copy_from_user,get_user,put_user函数比较
- How to access data/data folder in Android device?
- Cora Data - iOS 7 上关于 Raywenderlich.com 中 How to Preload and Import Existing Data 的注解
- Core Data on iOS 5 Tutorial: How To Preload and Import Existing Data
- How To Perform a Full Export And Exclude Certain Schemas Using The Data Pump API? [ID 1340781.1]