realm

Where to quit the handler thread that used for realm operations in Android?

試著忘記壹切 提交于 2019-12-23 05:34:19
问题 I have an android application that I do many realm operations . I wanted to do those stuff on background and to do that I have used handler threads . I also used handler threads in some of my activities and service classes and I quit() those handler threads inside of onTerminate() or onDestroy() methods. However I do not know where should I quit the handler thread when I use it inside if a non-activity classes since they do not have onDestroy() methods. I have commented the handlerThread.quit

Realm Swift use locally only, however it still tries to connect online

时间秒杀一切 提交于 2019-12-23 04:13:06
问题 I am following the realm swift getting started guide here and it is working fine. I have the following object: class Dog: Object { dynamic var name = "" dynamic var age = 0 } and in my viewcontroller I have override func viewDidLoad() { super.viewDidLoad() print(Realm.Configuration.defaultConfiguration.fileURL!) let myDog = Dog() myDog.name = "Rex" myDog.age = 1 let realm = try! Realm() try! realm.write { realm.add(myDog) } } little snitch reports that realm tries to connect to static.realm

Error deserializing a RealList<RealmString> Into List<String>

我的未来我决定 提交于 2019-12-23 02:20:42
问题 Due to Realm inability to work with promotive types, which include String s, I'm trying to implement a JsonDeserializer just like in this question. The issue is that I'm baffled on to why I'm getting the following error: W/System.err: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING This is part of the Json: "tags": ["GLUTEN FREE", "NUT FREE"], My RealmString: public class RealmString extends RealmObject { private String value; public

This method is only available in managed mode

帅比萌擦擦* 提交于 2019-12-23 01:43:12
问题 I'm develop an Android app with Realm integrated and I have a problem when I try to search with a query. I try to search a product by its "id" into product list passed by parameter. This method worked perfect but suddenly I got the next exception: Process: com.singularfactory.ecommerceapp.ecommerceapp, PID: 9372 io.realm.exceptions.RealmException: This method is only available in managed mode at io.realm.RealmList.where(RealmList.java:260) at com.singularfactory.ecommerceapp.utility.UtilityDB

RLMException when trying to perform Realm transaction with Grand Central Dispatch

戏子无情 提交于 2019-12-23 01:42:51
问题 I have these two declared as globals in my AppDelegate var realmdb: RLMRealm! var realmQueue = dispatch_queue_create("com.pesto.realmdb", DISPATCH_QUEUE_SERIAL) In my application(_, didFinishLaunchingWithOptions: _) I set a reference of defaultRealm to my global realmdb like so: dispatch_async(realmQueue) { realmdb = RLMRealm.defaultRealm() } In another class in my code I have this method: private func handleChatMessage(message: PSTChatMsg) { // check if there is a channel environment for

Creating managed RealmList outside RealmObject

六眼飞鱼酱① 提交于 2019-12-23 01:15:23
问题 In my app, I have a method that accepts an ArrayList of ID's and returns a RealmList of Machines belonging to these IDs. public RealmList<Machine> getMachinesById(ArrayList<Long> machineIds) { RealmList<Machine> machines = new RealmList<Machine>(); for (int i = 0; i < machineIds.size(); i++){ Machine m = getMachineById(machineIds.get(i)); if (m != null) { machines.add(m); } } return machines; } The getMachineById() function just finds the correct machine for a specific id. I want to filter

Query realm data contained on other object

混江龙づ霸主 提交于 2019-12-23 01:06:11
问题 This question is a follow-up question from: Organize Android Realm data in lists Due to the data returned by the API we use, it's slightly impossible to do an actual query on the realm database. Instead I'm wrapping my ordered data in a RealmList and adding a @PrimaryKey public String id; to it. So our realm data looks like: public class ListPhoto extends RealmObject { @PrimaryKey public String id; public RealmList<Photo> list; // Photo contains String/int/boolean } which makes easy to write

Incorrect UI update after reordering rows in UITableViewController

﹥>﹥吖頭↗ 提交于 2019-12-22 19:43:37
问题 So I was reordering rows in a table, the UI end results were incorrect. Here comes the scenario: Table content originally: a b c d e If I move Row 0 (currently a ) to Row 4 (currently e ), the end result that I am seeing is: c d e a a A little bit of the context: The table is reading a list of Realm objects. I confirmed that the Realm objects are properly updated as well. If I put a tableView.reloadData() right after reordering the rows, I can get the correct UI results. However, reloading

Retrieve the List property count of realm for tableview Swift

烂漫一生 提交于 2019-12-22 18:05:22
问题 I am using Realm 3 and Swift 4 and still new to Realm and Swift. Need a guidance here :) Given this realm model class Person: Object, Mappable { let dog = List<Dog>() required convenience init?(map: Map) { self.init() } } How can I get the dog count of each person? What i want to achieve is there are multiple sections on my table view and for each person there will be dog list for the respective person. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { let

Saving Data from CSV to Realm

痴心易碎 提交于 2019-12-22 13:58:07
问题 I have been creating a Dictionary App i have all words saved in the .csv file when app is run First Time, this method should save all the words to realm db but saving only few. Task java.util.concurrent.FutureTask@286858df rejected from io.realm.internal.async.RealmThreadPoolExecutor@273caff5[Running, pool size = 13, active threads = 13, queued tasks = 100, completed tasks = 1] realm = Realm.getDefaultInstance(); //adding to db satrt if (!(realm.isEmpty())) { Log.v("DB","already there!!"); }