realm

Realm.io and asynchronous queries

a 夏天 提交于 2019-12-07 02:48:48
问题 We are starting to use Realm.io in an android app project. But something that we don't like with the Realm.io API is the absence of any asynchronous way to query the database. In old projects we used DbQuery and Sqlite, so we are used to make the database queries inside threads or AsyncTask 's. But is quite disturbing see that in all the examples the queries are made in the UiThread . Isn't this a bad thing for the app performance?. We tried to make the queries inside threads or AsyncTasks

Any way to convert Realm database file in to sqlite?

百般思念 提交于 2019-12-07 02:15:30
问题 I have realm database (.realm) from an existing application, which has more than 400k records. I dug my head in to this for more than 3-4 hours, but I couldn't find any fruitful results towards converting a .realm file in to a sqlite file. 回答1: Any data conversion so far has been done manually. People have converted from Core Data to Realm by grabbing the objects from Core Data and then saving them to a Realm. I imagine your best bet will be similar here. Grab each object from the Realm and

Testing Realm under Android

拟墨画扇 提交于 2019-12-07 00:21:22
问题 I have an application for Android where I use Realm to persist data. I now want to write a unit test for this application, utilizing Realm. However, I do not want the unit test to interfere with my existing Realm data. So I want to generate different Realm files for my test Instance. I don't care if they have a different name, or are stored in a different directory. I have tried to use a RenamingDelegatingContext , but with no success. According to https://groups.google.com/forum/#!msg/realm

How to perform Realm count query

拟墨画扇 提交于 2019-12-06 23:11:29
问题 How can I do a count query on Realm? for example this is my model class Dog: Object { dynamic var name = "" } class Person: Object { dynamic var name = "" let dogs = List<Dog>() } I want to fetch all persons with at least one dog something like Realm().objects(Person).filter("dogs.@count > 0") but @count isn't supported as i understand 回答1: Yes, Realm still does not support .@count query. You can work around that you modify the Person model to have a count property. Then you update the count

Have I used Singleton with Realm Database correct?

坚强是说给别人听的谎言 提交于 2019-12-06 22:31:09
问题 I have an app where the user can create/delete/edit to a list from a DialogFragment. Before I had a method like this in my DialogFragments: MainActivtity.adapter.add(String name, String location, double price); adapter is my adapter object for the recyclerView. The class for the adapter had my create/delete/edit methods for the items in the recyclerView. Which was called like shown above which also is a horrible way to call mehtods as I understand. So I choose to put all these CRUD methods in

React Native Realm Project Structure

↘锁芯ラ 提交于 2019-12-06 21:45:31
What's the best way to implement realm in react native(project structure), when you have multiple webAPI methods and tables to store. I'm doing the following is this a right approach or not? If not kindly suggest or provide any link. created a model folder - each js file in this folder have a model class extended with RealmObject. Created a folder for asynchronous tasks - each js file in this folder Calls web api and write data in Realm objects. Every webapi function has a sperate js file. Initially when app loads on component mount call all important async tasks and call rest of them wherever

Store data into Realm through Retrofit 2

☆樱花仙子☆ 提交于 2019-12-06 21:04:31
I am new for Realm integration. I am trying to save my retrofit json response into Realm database. But still I am confuse how to complete this task for retrofit 2. I am getting json response and extends RealmObject class as per RealM documents. but still not getting any good way to store my response into realm directly. Dashboard Activity: apiInterface = APIClient.getClient().create(APIInterface.class); final Call<RealmList<ExampleTest>> call = apiInterface.getSurvay(); call.enqueue(new Callback<RealmList<ExampleTest>>() { @Override public void onResponse(Call<RealmList<ExampleTest>> call,

Realm data Insertion took over 7mins for big size json

ⅰ亾dé卋堺 提交于 2019-12-06 20:38:30
I use Alamofire to download big json data which was about around 7MB and use RealmSwift to store data at realmobject and SwiftyJSON to parse.My realm object insertion after it finished download the json seems really slow at insertion.Was something wrong with my bad code?Please guide me. First of all I will show simplest Json : { { "Start" : "40000", "End" : "1000000", "Name" : "Smith", "Address" : "New York" },{...},more than 7000 records... } Here is my AlamofireAPI Protocol import Foundation import Alamofire import SwiftyJSON protocol RequestDataAPIProtocol{ func didSuccessDownloadingData

Cannot load underlying module for 'RealmSwift'

旧街凉风 提交于 2019-12-06 19:37:04
问题 I'm trying to install Realm for Swift via Cocoapods. First what I did was pod init into my project Then I open podfile and changed it like this: target 'Taskio' do use_frameworks! pod 'RealmSwift' end Then I closed podfile and execute command pod install Everything pass good. But now when i opened workspace I'm getting error while importing RealmSwift Cannot load underlying module for 'RealmSwift' 回答1: Firstly try to check what workspace you open after cocoapods were install open App

RealmList of String Type in Android

最后都变了- 提交于 2019-12-06 18:31:19
问题 I'm using Realm for Local storage in Android. I'm getting following response form server. [{ "ListId": 10, "Names": ["Name1", "Name2", "Name3", "Name4"] }] Here is my Model public class Model extends RealmObject { private int ListId; private RealmList<String> Names = new RealmList<String>() public int getListId() { return ListId; } public void setListId(int listId) { ListId = listId; } public RealmList<String> getNames() { return Names; } public void setNames(RealmList<String> names) { Names