Documentation's instructions generate Exception: "io.realm.exceptions.RealmException: Removing is not supported."
See original GitHub issueI just started playing around with Realm on a small project I have. I want to be able to delete objects from the database. Your documentation states I should do the following:
// remove a single object
Dog dog = result.get(5);
dog.removeFromRealm();
This throws an exception instead of working:
io.realm.exceptions.RealmException: Removing is not supported.
at io.realm.RealmResults$RealmResultsIterator.remove(RealmResults.java:552)
at java.util.AbstractCollection.remove(AbstractCollection.java:229)
And it is because the code always throws an exception at that point: https://github.com/realm/realm-java/blob/71e94e1ab8688bfb796e9f0e401462060428cd40/realm/src/main/java/io/realm/RealmResults.java#L552
What is the workaround here? Why hasn’t the documentation been updated?
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Examples should be self-contained · Issue #1763 - GitHub
Documentation's instructions generate Exception : "io.realm.exceptions.RealmException: Removing is not supported." #1487.
Read more >What happened to removing items from realm.io ...
io.realm.exceptions.RealmException: Removing object is not supported. Then I looked at the source code of RealmResults.java and I find this: ...
Read more >How to Fix the Unsupported Operation Exception in Java
UnsupportedOperationException is a Java runtime exception that occurs when an unsupported operation is requested but could not be performed.
Read more >Keychain returned unexpected status code - Realm - MongoDB
I install nuget Realm10.0.0.beta1 when code run on: var app = App.Create("realmmongoapp-ywehx"); I have this exception: Realms.Exceptions.
Read more >Could not find the generated RealmProxy class: Annotation ...
... io.realm.exceptions.RealmException: Could not find the generated io.realm.IngradientRealmProxy class: Annotation processor may not have been executed.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have tried again to get this working, to no avail.
I load from the database players for my app:
This array is then passed to an ArrayAdapter class to be shown in a listview, with a button for deleting the player.
This calls delete player on the original Activity. Originally I had this code:
I thought this would work as per the example in your documentation, but it doesn’t, it calls the “Removing is not supported” function and crashes my app.
So based on your suggestion, I thought I needed to do a new
get()
call on the original RealmResults and remove it that way, so I changed the code:This as well causes the Exception to be thrown.
This is your documentation:
There is no context here at all for me to figure out what result is, or how it was acquired. How is my code any different from what’s in your documentation? There’s no warning that the iterator version of the the removeFromRealm method will always throw an exception, nor how to avoid that. This is so far some of the worst documentation I’ve run into for an Android library, and if you expect people to use your product you should have better examples and documentation.
I tried some times, but I arrive at the same exception: I have a a list of TravelsRealms object:
I user “for” to search inside this list. when objcet is correct, I delete it with a simple remove. I tried with other method like remove(Object), or call t.deleteFromReam(). I have the same error every time