在android中執行sqlite資料庫操作拖慢了我的應用程式,但什么是消除這種遲緩的好方法? 我應該在一個獨立的執行緒上執行資料庫操作,還是有其他更合適的方法?
uj5u.com熱心網友回復:
確切地說,你應該這樣做。如果你使用Room,它將極大地幫助你,因為它支持livedata/flow,你可以只從你的片段中觀察,它不會在主執行緒中執行資料庫操作。
什么是Room。 https://developer.android.com/training/data-storage/room
Google codelab可以幫助你開始行動。 https://developer.android.com/codelabs/android-room-with-a-view-kotlin#0
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/309808.html
標籤:
