Ad
How To Check Room Database Have Entities Or Not?
I need to request to the server and pass data from my local Database whenever the app is started again. Now the problem is that when opening the app for the first time I know there are no entities how can check if Room database have entities or not?
Ad
Answer
Since you did not post any code I can only assume it works properly. You probably have an Entity
object and DAO
interface.
If you did everything as you needed to the data returned from the query is a List<YOUR ENTITY>
and when the app is run for the first time that list should be empty.
So:
if (list.isEmpty()) { do something }
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad