question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalStateException: Changing Realm data can only be done from inside a transaction.

See original GitHub issue
10-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:closed
  • Created 8 years ago
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
dalinaumcommented, Oct 5, 2015

@mubarak1361 How about adding beginTransaction() before post.setBody("Hello Wolrd")? Do you still get IllegalStateException?

1reaction
MenilVcommented, Oct 12, 2016

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found