realm

Retrofit + RealmList + Gson stuck in a loop until out of memory

六眼飞鱼酱① 提交于 2019-11-29 04:45:47
I'm trying to user Retrofit + Realm + Gson, but when the RealmList is used the app get stuck. If I remove the RealmList objects everything work's fine, but I need the object list. Logcat: (32099): Background sticky concurrent mark sweep GC freed 278516(15MB) AllocSpace objects, 0(0B) LOS objects, 25% free, 23MB/31MB, paused 2.533ms total 1.049s (32099): Background partial concurrent mark sweep GC freed 137132(8MB) AllocSpace objects, 0(0B) LOS objects, 40% free, 23MB/39MB, paused 4.211ms total 188.951ms (32099): Background sticky concurrent mark sweep GC freed 271335(15MB) AllocSpace objects,

Realm VS Room in Android [closed]

北城余情 提交于 2019-11-29 04:24:37
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . I'm building an app and I need to use a database in it. I'm considering using Room as it's new and hot right now. But I've heard a lot of great stuff about Realm too. Can someone point out the possible advantages of using each? I did my research and read the docs but I have

How to backup Realm DB in Android before deleting the Realm file. Is there any way to restore the backup file?

≡放荡痞女 提交于 2019-11-29 04:17:17
I am working on an Android application where I will be deleting Realm before copying the new data to Realm. Is there any way I can take backup of the data before deleting it and restore it back if something is wrong when using realm.copyToRealm() ? Realm.writeCopyTo might be helpful for this case. You can find doc here. //Backup Realm orgRealm = Realm.getInstance(orgConfig); orgRealm.writeCopyTo(pathToBackup); orgRealm.close(); //Restore Realm.deleteRealm(orgConfig); Realm backupRealm = Realm.getInstance(backupConfig); backupRealm.writeCopyTo(pathToRestore); backupRealm.close(); orgRealm =

Shiro的几个关键类

有些话、适合烂在心里 提交于 2019-11-29 03:32:08
Shiro在于Spring集成中,需要配置SecurityManager,Realm,ShiroFilterFactoryBean这三个类。在Web环境中SecurityManager一般配置DefaultWebSecurityManager,如果需要扩展或者定制一些额外的功能,可以配置DefaultWebSecurityManager的继承类;Realm需要先继承AuthorizingRealm抽象类再配置,如果有多个Realm的话,还需要配置ModularRealmAuthenticator的继承实现类;ShiroFilterFactoryBean主要是提供ShiroFilter,可以配置一些资源的拦截。下面对一些核心类进行一下总结。 SecurityManager 该类继承了三个接口,还额外提供登录,退出和创建用户的功能。 /** * 所有与安全有关的操作都会与SecurityManager交互 * 扩展了authenticator、authorizer和sessionmanager接口 */ public interface SecurityManager extends Authenticator, Authorizer, SessionManager { Subject login(Subject subject, AuthenticationToken

Proper way to get Realm object by its primary key in Android Java

坚强是说给别人听的谎言 提交于 2019-11-29 02:54:16
问题 I wonder if there's a proper way to retrieve an object given its primary key in Realm for Android. I know the method objectForPrimaryKey does exists in Swift but there seems to be no such counterpart in Realm for Android. I really think that doing realm.where(EventInfo.class).equalTo("id", eventInfo.id).findFirst(); looks like a lot of waste (at least it is not wrist-friendly). Am I missing some method? I'm Currently using Realm 1.0.1 回答1: This is why I have a Realm repository like this one

Realm and auto increment Behavior (Android)

萝らか妹 提交于 2019-11-29 02:26:57
问题 I'm trying to get data from Realm using an ID as a reference. However, when querying for an ID, I've found that Realm is giving me the same ID for all elements (ID of 0). Why doesn't the ID auto-increment when I use the @PrimaryKey annotation on the model's ID? Here's the shortened class for the model: public class Child_pages extends RealmObject { @PrimaryKey private int id_cp; private int id; private String day; private int category_id; And the query I'm executing is: realm.where(Child

Realm: Use one or multiple realms in an app (and one or multiple schemas)

白昼怎懂夜的黑 提交于 2019-11-29 02:18:55
问题 I'm implementing an app that persists data at some points (not related between them) using Realm. In example: Save the items favorited by the user. (The app have a chat) Save the chat conversations and recent constants Implement a persistent cache for some requests of the app Save recent searches/form in order to provide autocompletion (Lets name each one of those points as a module/package) Each module/package have some RealmObjects to persist. How should I organize this? From the point of

Realm Migration doesn't work

南楼画角 提交于 2019-11-29 01:13:18
问题 let config = Realm.Configuration( // Set the new schema version. This must be greater than the previously used // version (if you've never set a schema version before, the version is 0). schemaVersion: 1, // Set the block which will be called automatically when opening a Realm with // a schema version lower than the one set above migrationBlock: { migration, oldSchemaVersion in // We haven’t migrated anything yet, so oldSchemaVersion == 0 if (oldSchemaVersion < 1) { // Nothing to do! // Realm

How to add the parent path to RealmSwift.framework in the “Framework Search Paths” section?

随声附和 提交于 2019-11-29 00:42:38
This is step is listed in the instructions for installing Realm. link here: https://realm.io/docs/swift/latest/ I am new to xcode and I don't understand how to complete this step. Can someone give me detailed instructions? I found the Framework Search Paths section in the build settings, but I don't even know what it means to add a parent path. I also need help with the next step, creating a new run script phase. xcode ver 6.4 If you follow to 2nd step correctly, the project directory will be like following: Now, you can build main app's target fine. However, if you execute the unit test with

RLMException, Migration is required for object type

五迷三道 提交于 2019-11-28 20:20:51
I have an object NotSureItem in which I have three properties title whose name is renamed from text and textDescription which I had added later and a dateTime property. Now when I am going to run my app it crashes when I want to add something to these properties. It shows following statements. 'Migration is required for object type 'NotSureItem' due to the following errors: - Property 'text' is missing from latest object model. - Property 'title' has been added to latest object model. - Property 'textDescription' has been added to latest object model.' Here is my code: import Foundation import