sqlbrite

How to handle multiple data sources with rxjava?

社会主义新天地 提交于 2021-02-08 03:46:53
问题 This is the case: I have the domain layer to provide data fetching interface for business logics, and I have 2 data sources: local database and remote network. It works like this: Request all users: DataRepository.getInstance().getUsers(); In DataRepository, there are 2 sources: LocalDataSource.getUsers() which fetches all users from local database, if there is no data then ignore this request. RemoteDataSource.getUsers() which requests latest user list from our server(Even if there is data

How to handle multiple data sources with rxjava?

蹲街弑〆低调 提交于 2021-02-08 03:46:25
问题 This is the case: I have the domain layer to provide data fetching interface for business logics, and I have 2 data sources: local database and remote network. It works like this: Request all users: DataRepository.getInstance().getUsers(); In DataRepository, there are 2 sources: LocalDataSource.getUsers() which fetches all users from local database, if there is no data then ignore this request. RemoteDataSource.getUsers() which requests latest user list from our server(Even if there is data

Possible to get specific error details from Android SQLiteConstraintException?

孤者浪人 提交于 2019-12-19 06:13:08
问题 I'm getting the following error for certain data, and concept is clear enough: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787) However, that doesn't help me find which specific record has the invalid FK. Rather than thrash my code and try to isolate every insert with a new transaction, is there any way to turn on (or extract) logging with helpful details such as the table in question or even the FK value that is causing trouble? Also, I'm using

pthread_create failed: couldn't allocate 1064960-byte stack: Out of memory

假如想象 提交于 2019-12-12 03:29:01
问题 I have two fragments where inside both of these fragments, it will execute codes that utilize sqlbrite. While the app won't crash in normal usage, but the problem is, if I load these 2 fragments back-and-forth multiple times in a short period, the app will crash with this error. E/CursorWindow: Could not allocate CursorWindow '/data/data/com.imincode.meniti/databases/meniti' of size 2097152 due to error -12. E/CursorWindow: Could not allocate CursorWindow '/data/data/com.imincode.meniti

Android ListView adapter with two ArrayLists

江枫思渺然 提交于 2019-12-07 06:35:16
问题 In our chat app we want to use cool new Library SQLBrite to update chat on database changes. Since our chat has endless scrolling, and chat room can have very big list of messages, we want to split ArrayList supplied to Chat ListView adapter into two lists. Check graphic for the idea. We want to set point in database above which, old messages will be queried by normal SQLite queries. And below that point we want set SQLBrite, that will bring us fresh messages added to database. Each part

Refreshing data using SQLBrite + Retrofit

拥有回忆 提交于 2019-12-06 08:22:05
问题 Here is my use case: I am developing an app that communicates with a server via a REST API and stores the received data in a SQLite database (it's using it as a cache of some sorts). When the user opens a screen, the following has to occur: The data is loaded from the DB, if available. The app call the API to refresh the data. The result of the API call is persisted to the DB. The data is reloaded from the DB when the data change notification is intercepted. This is very similar to the case

Android ListView adapter with two ArrayLists

耗尽温柔 提交于 2019-12-05 10:50:55
In our chat app we want to use cool new Library SQLBrite to update chat on database changes. Since our chat has endless scrolling, and chat room can have very big list of messages, we want to split ArrayList supplied to Chat ListView adapter into two lists. Check graphic for the idea. We want to set point in database above which, old messages will be queried by normal SQLite queries. And below that point we want set SQLBrite, that will bring us fresh messages added to database. Each part should populate its corresponding ArrayList. And two arrayLists should be combined in one adapter. My

Refreshing data using SQLBrite + Retrofit

匆匆过客 提交于 2019-12-04 13:05:39
Here is my use case: I am developing an app that communicates with a server via a REST API and stores the received data in a SQLite database (it's using it as a cache of some sorts). When the user opens a screen, the following has to occur: The data is loaded from the DB, if available. The app call the API to refresh the data. The result of the API call is persisted to the DB. The data is reloaded from the DB when the data change notification is intercepted. This is very similar to the case presented here , but there is a slight difference. Since I am using SQLBrite, the DB observables don't

Possible to get specific error details from Android SQLiteConstraintException?

╄→гoц情女王★ 提交于 2019-12-01 04:16:29
I'm getting the following error for certain data, and concept is clear enough: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787) However, that doesn't help me find which specific record has the invalid FK. Rather than thrash my code and try to isolate every insert with a new transaction, is there any way to turn on (or extract) logging with helpful details such as the table in question or even the FK value that is causing trouble? Also, I'm using SqlBrite, and have turned debug logging on (that just logs the operations, I still don't get more info on