java.lang.IllegalStateException: Changing Realm data can only be done from inside a transaction.
See original GitHub issue10-05 03:44:32.511 1402-1402/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.test.materialup, PID: 1402
java.lang.IllegalStateException: Changing Realm data can only be done from inside a transaction.
at io.realm.internal.Table.throwImmutable(Table.java:1474)
at io.realm.internal.Table.checkImmutable(Table.java:1074)
at io.realm.internal.UncheckedRow.setString(UncheckedRow.java:207)
at io.realm.PostRealmProxy.setBody(PostRealmProxy.java:92)
at com.test.materialup.ui.PostActivity.onClick(PostActivity.java:107)
at com.test.materialup.adapter.PostRecyclerAdapter$PostViewHolder$1.onClick(PostRecyclerAdapter.java:71)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
While changing a Post object value it gets crashing
@Override
public void onClick(int position) {
Post post = postRecyclerAdapter.getPost(position);
post.setBody("Hello Wolrd");
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:23 (10 by maintainers)
Top Results From Across the Web
Changing Realm data can only be done from inside a ...
Persisting objects with Realm (error: Changing Realm data can only be done from inside a transaction) ; realmConfig = ; new RealmConfiguration ......
Read more >Realm (Realm 10.3.0) - MongoDB
Objects within a Realm can be queried and read at any time. Creating, modifying, and deleting objects must be done while inside a...
Read more >DynamicRealm (Realm 0.88.1)
DynamicRealm is a dynamic variant of Realm . This means that all access to data and/or queries are done using string based class...
Read more >The things I've learned using Realm | by Gabor Varadi - Medium
In case of Realm, we can observe the query results — in fact, Realm automatically updates it for us, whenever it's been changed....
Read more >Realistic Realm - lessons learned after using it for 1.5 years
Due to this, zero copy is achieved. Transactions — All changes of the linked data objects need to be done inside the transaction....
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
@mubarak1361 How about adding
beginTransaction()
beforepost.setBody("Hello Wolrd")
? Do you still get IllegalStateException?@sirvon yeah, actually an Observable is probably the way to go here. Didn’t think of it right away. btw @Zhuinden this article is great.