Questions tagged [realm-java]

99 questions
1
vote
1 answer

Realm Java Sort By RealmList Link

If I have the following models: class Conversation extends RealmObject { RealmList messages; } class Message extends RealmObject { long timestamp; } How can I say: give me all Conversations with the list of Message sorted, and the…
Eliezer
  • 7,209
  • 12
  • 56
  • 103
1
vote
0 answers

Do I need separate Realm instances to "close" my RealmResults and stop auto-updating?

Right now synchronous RealmQueries (with multiple sort fields on 35k objects) are slowing down my main thread, even after their Activity was closed. Currently I cannot use asynchronous queries due to a BadVersionException, I have not yet figured…
ferbeb
  • 163
  • 1
  • 2
  • 11
1
vote
0 answers

Toggle button on click

I have a "subscribe" button in one of my views that lets the user subscribe to updates on another user. The button toggles between "subscribe" and "subscribed". Here is the activity in charge of that view: public class ProfileActivity extends…
user7451663
1
vote
1 answer

Issue with OkBuck and Realm

My build and APK are successfully generated, but when I run the app an error is raised, forcing close the app. If I build the same dependencies with Gradle, not using OkBuck, it runs perfectly. Logcat: E/AndroidRuntime( 3447): FATAL EXCEPTION:…
1
vote
2 answers

How to delete first n rows in realm

Suppose there is a table called RecentViewItem which stores recently viewed items by user. I want to keep only first 10 recently viewed items by deleting all other items. My query is like this: RealmResults results = …
iamcrypticcoder
  • 2,609
  • 4
  • 27
  • 50
1
vote
1 answer

How to apply encryption to an existing realm database in Android?

I have gone through this question and similar questions, but I am still unable to figure this out. Earlier I was using SQLite for my android app. Size of pre-populated Sqlite database is about 15 MB. I made an temporary android app to my copy my…
Dr. Atul Tiwari
  • 1,085
  • 5
  • 22
  • 46
0
votes
0 answers

How to read/write realm database created in react native via native/turbo/expo modules?

Should I use realmjs for react native, realm-kotlin for android and realm-swift for iOS? Is there any documentation giving guidance on how to achieve this? I found it really hard to do it I don't know where to start it. Please help thank you.
Bruce
  • 457
  • 1
  • 5
  • 18
0
votes
0 answers

Filtering by dot notation and only returning specific results

Customer class @RealmClass public class Customer extends RealmObject { @PrimaryKey private int id; private int customerSerial; @Required private String customerName; private RealmList invoices = new RealmList<>(); …
Raymond Herring
  • 347
  • 1
  • 3
  • 10
0
votes
0 answers

Realm Proxy class are not generated

I have updated my Realm from 7.0.0 to 10.13.0. After updating I am facing issues in realm proxy classes. All my old import codes of proxy classes show Cannot resolve symbol 'com_example_android_model_XXXXRealmProxy. I have updated my android target…
nandha-dev
  • 153
  • 1
  • 3
  • 11
0
votes
0 answers

How to dynamically update ui using MongoDB realm

I am new to working with Realm and MongoDB and I was wondering if there is a better way of updating the UI. I want the UI to be updated for the fields that have been changed is there a way to identify that so that I can avoid updating fields that…
0
votes
0 answers

Realm with kotlin use syntax: This Realm instance has already been closed, making it unusable

I'm packing all realm operation inside one object: object RealmDatabase { private val config = RealmConfiguration.Builder().name("XXX").build() init { Realm.setDefaultConfiguration(config) } fun getClassTimetables() :…
Hhry
  • 823
  • 1
  • 8
  • 19
0
votes
0 answers

Realm-Java sort string but as integer

I have model class which contains string variable. I want to sort it with that variable but as Int open class Item: RealmObject() { var name: String var price: String } i want somthing like this : Realm.where(Item::class.java) …
zihadrizkyef
  • 1,849
  • 3
  • 23
  • 46
0
votes
0 answers

kotlinx serialization custom serlializer for custom List (RealmList) class

I'm using the Realm database in Kotlin on Android along with some data that we're receiving over the wire using JSON, using kotlinx.serialization as the JSON library. I'd like to write a custom serializer for RealmList. An example class…
SuperDuperTango
  • 1,398
  • 1
  • 14
  • 32
0
votes
1 answer

Realm Android run query of if field contain value in a List

This is My RealmObject: public class Channel extends RealmObject{ private String id = ""; private String name = ""; ... I am trying to construct a query where each string in a list of string contains (not equal) to the "name" field. I am…
ia244
  • 145
  • 1
  • 10
0
votes
1 answer

Realm doesn't support this field type: Companion

I'm facing off an issue due to companion object inside a Realm entity. Example: // Entity open class MyEntity( @PrimaryKey var id: String? = "", // other fields... ): RealmObject() { companion object{ fun clean(realm: Realm)…