开发者

AsyncTask and SQLite Database

What's the best way to access the database through an async task?

I don't think I should pass in a reference to the DbAdapter that the activity is using (could be closed as the activity may be garbage开发者_开发知识库-collected).

Also, the db needs a context to be opened and closed, but I don't have that with the async task.


AsyncTask is an abstract class, so you have to extend it.

Create a class which extends AsyncTask, then in the constructor of this class you can add every things you want like the Context.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜