realm

How to update the values in Table using Realm android?

一曲冷凌霜 提交于 2020-01-22 12:56:05
问题 I have table say Student .I want to updated the values in the table and it does not have any primary key. I am using Realm Database for the same. 回答1: Assume You have VisitingCardPOJO you can find element depending on "no" use findFirst() if you want to update only first element or you can use findAll() you get list of record then you update same way below using for loop public void updateNewCard(Realm realm, VisitingCardPOJO card) { VisitingCardPOJO toEdit = realm.where(VisitingCardPOJO

RealmObject AND Parcelable

时光总嘲笑我的痴心妄想 提交于 2020-01-21 04:34:12
问题 I'm new to Realm for Android so I'm not sure I'm approaching this the right way. I have a class which looks like this: public class Entry extends RealmObject implements Parcelable { ... } The problem is the Parcelable interface contains methods like describeContents() writeToParcel() and RealmObjects aren't supposed to have methods other than getters and setters: Error:(81, 17) error: Only getters and setters should be defined in model classes So my question is: How can I make these two work

RealmObject AND Parcelable

半世苍凉 提交于 2020-01-21 04:34:07
问题 I'm new to Realm for Android so I'm not sure I'm approaching this the right way. I have a class which looks like this: public class Entry extends RealmObject implements Parcelable { ... } The problem is the Parcelable interface contains methods like describeContents() writeToParcel() and RealmObjects aren't supposed to have methods other than getters and setters: Error:(81, 17) error: Only getters and setters should be defined in model classes So my question is: How can I make these two work

Using Realm inside framework

谁说我不能喝 提交于 2020-01-17 07:09:29
问题 I can not use Realm within my framework as a framework because apple rejects nested frameworks. However maybe there is no problem in using Realm as a pod depedence within my framework. Or is there a problem? How does objective C be a single namespace I will not have collisions? In my framework I want to capture GPS coordinates. What is the benefit of using Realm for this versus file system? Thanks 回答1: You're correct that the iOS App Store doesn't allow nested dynamic frameworks. The

Using Realm inside framework

主宰稳场 提交于 2020-01-17 07:09:02
问题 I can not use Realm within my framework as a framework because apple rejects nested frameworks. However maybe there is no problem in using Realm as a pod depedence within my framework. Or is there a problem? How does objective C be a single namespace I will not have collisions? In my framework I want to capture GPS coordinates. What is the benefit of using Realm for this versus file system? Thanks 回答1: You're correct that the iOS App Store doesn't allow nested dynamic frameworks. The

Not able to use RealmAdapter - java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/TintManager;

大兔子大兔子 提交于 2020-01-17 06:51:32
问题 I am trying to use Realm Adapter in one of my projects. However I am not able to use it. When ever I add compile 'io.realm:android-adapters:1.0.1' into gradle file. Project gets compiled successfully, but the app crashes on tabLayout.setupWithViewPager(viewPager); -- the line where I am adding viewpager to tabLayout. App runs successfully when I comment compile 'io.realm:android-adapters:1.0.1' I am attaching the screenshot of the activiy where its crashing. Its crashing on line 57. I have

iOS Realm object by reference or duplicate objects

℡╲_俬逩灬. 提交于 2020-01-17 03:05:11
问题 I am using realm and I am not sure about this. I have two option to do in Post. One is to save entire owner object and another is to save only user object ID. If I save entire object, is it object by reference? I don't want to increase database size. The reason why I want to store entire object is that it is easy to access. It is like Post.User.email. I don't need to query. I read through realm though. https://realm.io/docs/objc/latest/ Thanks in advance. 回答1: No need to go by ID. In Realm,

Realm: The size of filled RealmList in RealmObject is zero

北城余情 提交于 2020-01-16 18:59:15
问题 Scenario: I have a model(DBBasket) to persist locally, the number of added products and products itself. When the user clicks on the + button under each product thumbnail I'm increasing totalQuantity in Product , Adding the product to the DBBasket , Set totalProducts which I get from server, in DBBasket too. Codes in + button: holder.HomeProductBindGrid.thatPlusButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Product productIns =

How to properly separate Realm from the rest of the app?

和自甴很熟 提交于 2020-01-16 11:26:11
问题 In my app I am trying to use MVVM with repositories databases and all that. I like to keep all my external dependencies and such separate and compartmentalized into their own files/modules so that they can easily be replaced or swapped out. With Realm I could make this work really well by using unmanaged objects. I can have a RealmHelper class for example which just opens a realm instance, queries or performs some transaction and then closes the realm and returns an object. So how can I

Check if Realm data has been added on a specific date

心不动则不痛 提交于 2020-01-16 08:19:13
问题 I am trying create a lookup if there is any workout registered on a specific date. The Object class looks like this: class Workout: Object { @objc dynamic var date: Date? // List of exercises (to-many relationship) var exercises = List<Exercise>() } And class Exercise: Object { @objc dynamic var name: String? // List of sets (to-many relationship) var sets = List<Set>() var parentWorkout = LinkingObjects(fromType: Workout.self, property: "exercises") } In Realm, I can see that there is one