What is the onTr...
What is the onTr...
The onTrimMemory
method is a callback in Android that notifies your app when the system is running low on memory and your app should release resources to improve system performance[1][3]. It is part of the ComponentCallbacks2
interface, which extends the ComponentCallbacks
interface with additional callbacks for finer-grained memory management[3].
The onTrimMemory
method is called with a level
parameter that indicates the memory situation and how much memory your app should try to free[1][2][3]. The levels range from TRIM_MEMORY_RUNNING_MODERATE
when the device is beginning to run low on memory, to TRIM_MEMORY_COMPLETE
when your app's process is nearing the end of the background LRU list and will likely be killed soon if more memory isn't freed[3].
When onTrimMemory
is called, your app should release any non-critical resources it can to free up memory[1][3]. This may include:
expert
Gợi ý câu hỏi phỏng vấn
Chưa có bình luận nào