0

I am using a drag and drop listview backed by cursor adapter. To maintain the database I am updating the positions of database entries at the time of dragging a view.For this I am using the conventional method of SQLiteDatabase.rawQuery and then when the update operations are done I call notifyDataSetChanged to call my bindview method of cursoradapter to reposition the entries. This however is lagging the UI and leaving the app unresponsive. I tried to move all my database operations to AsyncTask using a single instance of my database. This also is lagging my UI as the threads are queuing and the listview has to wait till each asynctask completes.

My ListView is always waiting for the queries to complete.

What should be the correct way of execution for this scenario? Will the use of CursorLoader give me a snappy UI?

I've seen many apps doing drag and drop efficiently and most of them are using array adapters. But I need to update my database as the enteries in listview are moved.

Please tell me an efficient way...

EDIT: Ok I am re-implementing the structure as I just found out that the Async Tasks are not even queuing up.They are made for concurrency.

The right question to ask should be how to queue database queries in FIFO order? Any pointers regarding that?

Regards, Parvaz Bhaskar

4

1 回答 1

0

我最终通过实现线程并仅使用一个处理程序发布我的查询来管理我对数据库的 FIFO 调用。这使我的数据库查询排队,并且我事先更新了我的 UI ......所以我不必等待我的查询完成。

感谢我发现的所有链接最终都是 SO 链接。

于 2013-03-12T05:52:30.777 回答