Câu hỏi phỏng vấn Android
Câu hỏi

What is the onTr...

Câu trả lời

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:

  • Clearing bitmap caches
  • Unregistering listeners that are no longer needed...
expert

expert

Gợi ý câu hỏi phỏng vấn

middle

What is the difference between Adapter and Loader in Android?

entry

What is the difference between Bitmap and Drawable in Android?

middle

How can two distinct Android apps interact?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào