S
S
Sash0k_k2013-12-09 20:36:11
Android
Sash0k_k, 2013-12-09 20:36:11

How can Android use LoaderManager to track sqlite view changes?

Good evening.
I am developing for Android, I ran into a problem.
The project uses sqlite: work tables, lookup tables and a view to display the finished data.
Task: it is necessary to update the data in the table, and dynamically track / display changes in the associated view (view). I use LoaderManager for this, following the example from the article . On a clean table, everything works fine. But if you initialize a view instead of a table in the loader, the loader does not track changes in the data (onLoadFinished is not called).
Table:

CREATE TABLE [table_scan] (
   [_id] INTEGER PRIMARY KEY AUTOINCREMENT,
   [NR_ID] INTEGER NOT NULL,
   [T_ID] INTEGER NOT NULL,
   [Color_ID] INTEGER NOT NULL,
   [R_ID] INTEGER NOT NULL,
   [Barcode] TEXT NOT NULL,
   [NumberSeat] INTEGER,
   [Date] DATETIME NOT NULL DEFAULT(DATETIME('now', 'localtime')),
   [Deleted] INTEGER NOT NULL DEFAULT '0',
   [Status] INTEGER NOT NULL DEFAULT '0',
   [Export] INTEGER NOT NULL DEFAULT '0');

View:
CREATE VIEW [view_scan] AS SELECT _id, Barcode, Status, Deleted, NumberSeat,
 goods_catalog.T_Articul, colors_catalog.Color_Name, sizes_catalog.R_Name
 FROM table_scan
   INNER JOIN goods_catalog ON goods_catalog.T_ID = table_scan.T_ID
   INNER JOIN colors_catalog ON colors_catalog.Color_ID = table_scan.Color_ID
   INNER JOIN sizes_catalog ON sizes_catalog.R_ID = table_scan.R_ID
 WHERE Deleted = 0;

How can this problem be solved?
PS: you can't update the view, as it is written in the sqlite documentation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sash0k_k, 2013-12-11
@Sash0k_k

I found the solution myself. Described it in the article habrahabr.ru/post/205620

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question