This is a sample project demonstrating the use of the Reflective Drawable Loader Library.
The library (and code) can be found here: https://github.com/alt236/Reflective-Drawable-Loader---Android
Project Description
---
Were you ever in a situation where you had to access Drawables based on their names (for example if the Drawable names are stored in a DB) and you had to write long lookup tables converting the names into R.drawable.ids? And maintaining them?
This library is offering a way around it by using reflection to access the Drawable directly by name. You only need to include them as normal into your Res folder tree. It has been benchmarked at up to 5x faster than the platform's Resources.getIdentifier() method.
It is using LRU caching to mitigate the reflection time overhead for both reflection "hits" and "misses".
</div> <div jsname="WJz9Hc" style="display:none">Đây là một dự án mẫu thể hiện việc sử dụng các drawable Thư viện Loader phản quang.
Thư viện (và mã số) có thể được tìm thấy ở đây: https://github.com/alt236/Reflective-Drawable-Loader---Android
Mô tả dự án
---
Bạn có bao giờ trong một tình huống mà bạn đã truy cập Drawables dựa trên tên của họ (ví dụ nếu tên drawable được lưu trữ trong một DB) và bạn phải viết các bảng tra cứu dài chuyển đổi tên thành R.drawable.ids? Và duy trì chúng?
Thư viện này được cung cấp một cách xung quanh nó bằng cách sử dụng phản ánh để truy drawable trực tiếp bằng tên. Bạn chỉ cần bao gồm chúng như bình thường vào cây thư mục Res của bạn. Nó đã được quy chuẩn lên đến 5x nhanh hơn Resources.getIdentifier () phương pháp của nền tảng.
Nó được sử dụng LRU bộ nhớ đệm để giảm thiểu thời gian phản ánh trên không cho cả hai phản ánh "hit" và "bỏ lỡ".</div> <div class="show-more-end">