When should I do certain SQLite operations on another thread(not the main thread)?

前端 未结 3 427
情歌与酒
情歌与酒 2020-12-01 05:05

My Android application includes an SQLite database with an SQLiteOpenHelper class to help manage it. During application use, the user may perform some operatio

3条回答
  •  忘掉有多难
    2020-12-01 05:48

    Always measure before you optimize!

    Make sure that DB operations you do affect user experience and than start looking for a solution.

    If database stuff gets slow, then use AsyncTask, which was designed to perform tasks in the background, and then update the GUI on EDT.

提交回复
热议问题