{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/3299","repository_url":"https://api.github.com/repos/realm/realm-java","labels_url":"https://api.github.com/repos/realm/realm-java/issues/3299/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/3299/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/3299/events","html_url":"https://github.com/realm/realm-java/issues/3299","id":171352752,"number":3299,"title":" Android Realm get Not inside a transaction Error","user":{"login":"tux-world","id":6617583,"avatar_url":"https://avatars.githubusercontent.com/u/6617583?v=3","gravatar_id":"","url":"https://api.github.com/users/tux-world","html_url":"https://github.com/tux-world","followers_url":"https://api.github.com/users/tux-world/followers","following_url":"https://api.github.com/users/tux-world/following{/other_user}","gists_url":"https://api.github.com/users/tux-world/gists{/gist_id}","starred_url":"https://api.github.com/users/tux-world/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tux-world/subscriptions","organizations_url":"https://api.github.com/users/tux-world/orgs","repos_url":"https://api.github.com/users/tux-world/repos","events_url":"https://api.github.com/users/tux-world/events{/privacy}","received_events_url":"https://api.github.com/users/tux-world/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-16T08:30:24Z","updated_at":"2016-08-16T10:41:22Z","closed_at":"2016-08-16T10:41:22Z","body":"when i get data from dialog by listener as `interface` and try to save choosed data as class model. i can not create new row in table\r\n\r\nget data from dialog:\r\n\r\n    takeUserEwalletCurrency.setOnTakeUserEwallet(new TakeUserEwalletCurrency.IOnChooseEwallet() {\r\n        @Override\r\n        public void getItem(int item) {\r\n            takeUserEwalletCurrency.dismissDialog();\r\n            switch (item) {\r\n                case 1:\r\n                    String choiceUSDUserEwallet = \"SHUSD\" + userPhoneNumber.substring(1, userPhoneNumber.length());\r\n                    updateEwalletsHistory(choiceUSDUserEwallet, \"SHUSD\");\r\n                    to_ewallet.setText(choiceUSDUserEwallet);\r\n                    validateEnteredEwalletNumber();\r\n                    break;\r\n                case 2:\r\n                    ...\r\n                    break;\r\n            }\r\n        }\r\n    });\r\n    takeUserEwalletCurrency.showDialog();\r\n\r\ncreate new row:\r\n\r\n    private void updateEwalletsHistory(final String currentEwallet, final String ewalletCurrency) {\r\n        final EwalletsHistory exists_row = realm.where(EwalletsHistory.class).equalTo(\"ewalletName\", currentEwallet).findFirst();\r\n\r\n        if (exists_row == null) {\r\n            realm.executeTransaction(new Realm.Transaction() {\r\n                @Override\r\n                public void execute(Realm realm) {\r\n                    EwalletsHistory item = new EwalletsHistory();\r\n                    item.setEwalletName(currentEwallet);\r\n                    item.setEwalletCurrency(ewalletCurrency);\r\n                    realm.commitTransaction();\r\n                }\r\n            });\r\n        }\r\n    }\r\n\r\nboth of them such as Dialog interface and create new row in table are the same activity"}}
{"actor":{"display_login":"tux-world"}}