realm

Android Realm - debugging [duplicate]

陌路散爱 提交于 2019-12-12 11:02:44
问题 This question already has answers here : Cannot retrieve field values from realm object, values are null in debugger (3 answers) Closed 2 years ago . I want to see the values of Realm object variables For Example: Student (int studentID, ArrayList <Subject> subjectList) Subject (int subjectID, String subjectName) I want to see the names of subjects in a student object when debugging using Android Studio. Where should I look in android studio debug window to find a student's the subjects list?

Realm access from incorrect thread Exception while a copy was sent using copyFromRealm

一曲冷凌霜 提交于 2019-12-12 10:50:28
问题 When streaming copy of realm objects instead of realm reference and observing it on Schedulers.IO thread, there is a crash with the famous exception message "Realm access from incorrect thread. Realm objects can only be accessed in the thread they were created." Shouldn't the copy be thread free? Can I produce it from one thread and process it on a different thread? This is how I am creating observable. public Observable<Brand> getAllBrands() { return realm.where(Brand.class) .findAll()

Persisting objects with Realm (error: Changing Realm data can only be done from inside a transaction)

旧城冷巷雨未停 提交于 2019-12-12 10:47:07
问题 I am having difficulties getting Realm to work. RealmConfiguration realmConfig = new RealmConfiguration.Builder(this).build(); Realm.setDefaultConfiguration(realmConfig); Realm realm = Realm.getDefaultInstance(); MyObjectExtendingRealmObject myObject = new MyObjectExtendingRealmObject("John"); realm.beginTransaction(); realm.copyToRealm(myObject); realm.commitTransaction(); Error: java.lang.IllegalStateException: Changing Realm data can only be done from inside a transaction Call me crazy but

Realm: predicate returning LazyFilterCollection - how to convert to Results<T>?

倖福魔咒の 提交于 2019-12-12 10:44:39
问题 I'm filtering my database query with NSPredicate s directly on the database, but then I would like to go further and filter the returned values ( Results<T> ) with a custom predicate: elements.filter { (element) -> Bool in return ... } this one returns a LazyFilterBidirectionalCollection - how can I use this and get the Results again? 回答1: We're tracking adding support for block-based predicates in GitHub issue #2138. This will allow you to perform custom filtering outside of that supported

Realm Object Server 2 dashboard inaccessible

可紊 提交于 2019-12-12 10:21:03
问题 I've recently tried to install Realm Object Server from NPM (I'm on macOS ). I was used to the Realm Dashboard which was embedded in the "macOS Bundle" available for the 1.x version. It is unfortunately unavailable when attempting to reach http://localhost:9080 . There are now two things I think could be responsible for my issue: This feature was only present in the 1.x version This feature is not embedded in the NPM version Please note that I'm using (or at least want to use) the Developer

How to move my Realm file in SD card?

。_饼干妹妹 提交于 2019-12-12 09:56:56
问题 How to move my Realm file in SD card? And not just move, but also to connect to my application? 回答1: Realm also has constructors for opening any file: http://realm.io/docs/java/0.80.0/api/io/realm/Realm.html#getInstance-java.io.File-java.lang.String- So something like this should work: Realm realm = Realm.getInstance(Environment.getExternalStorageDirectory()); And remember to add this to your manifest: <manifest ...> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Realm with Content Provider

给你一囗甜甜゛ 提交于 2019-12-12 09:09:58
问题 So, I've been used Realm for a while. For now, I have a task to share the login data with my other apps. Since the login data is stored using Realm. I choose to use Content Provider. I found an example: https://speakerdeck.com/androhi/realm-with-contentprovider Unfortunately, I was unable to make it work. This is my Content Provider in app A static final String[] sColumns = new String[]{ "LoginResultData" }; public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String

Key Generation/Storage for react-native apps to encrypt realm db

自作多情 提交于 2019-12-12 09:04:16
问题 Does realm have any react-native support for key generation/key storage for encrypting the realm db? I wanted to check with the team working on realm before writing any native modules for the same. If there is any node module support for react native, that would be helpful. Thanks in advance. 回答1: Realm does not provide any APIs for the generation or storage of encryption keys. I'm copying a comment I made in the past on this issue below just to provide my thoughts on some considerations that

Realm.io Android best approach to get last 20 items from a table

北战南征 提交于 2019-12-12 08:50:00
问题 In a table of let say 100 items, which is the best approach to get the last 20 objects. One way I can think of is to load all the objects , reverse the array , create a new array and loop from the results for 20 times filling the new array and return it. Something like as follows : public ArrayList<DataObject> getLastItems (int qty){ RealmResults<DataObject>results = realm.where(DataObject.class).findAll(); Collections.reverse(results); ArrayList<DataObject>arrayList = new ArrayList<>(); for

iOS (Swift) Singleton Realm Object

前提是你 提交于 2019-12-12 08:10:12
问题 After reading this tutorial I need some assistance in understanding what the most efficient way to do the following. When my app is opened, it needs to load a Profile object. Since there should only be one of these in the lifetime of the app I set it up to be a singleton. Realm seemed to be a great way to save and retrieve data. Upon further viewing it seems I need to have a data model in order to use Realms. After a failed attempt of integrating Object into the Profile.swift shown below I