【发布时间】:2014-06-08 07:25:54
【问题描述】:
我正在使用 commonsware 的 Sqlite 加载器库,即cwac-loaderex。将 Sqlite 加载器对象设为单例是一种好习惯吗?
比方说,在一个新活动中,我想插入一条新记录,所以我必须对 Loader 对象执行此操作以使其反映在我的 UI 上。
但在新活动中,我不想像这样加载表格的所有内容
loader=
new SQLiteCursorLoader(this, db, "SELECT _ID, title, value "
+ "FROM constants ORDER BY title", null);
相反,通过单例使用共享加载器对象好不好?
编辑:
yes i know its deprecated. Here my question is. Lets say that i have created a sqlite loader object and displayed the contents on listview, and i will click on add new item button, it will take me to a new activity, ill fill out the details and press add. In this case the added object to reflect on listview we need to perform insert operation on sqliteloader object, so should i have to pass this object from listview via intent or is it ok to create a new sqliteloader object in the current activity and perform operation?
【问题讨论】:
标签: android sqlite android-loadermanager commonsware-cwac