{"action":"created","issue":{"url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/44","repository_url":"https://api.github.com/repos/googlesamples/android-architecture-components","labels_url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/44/comments","events_url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/44/events","html_url":"https://github.com/googlesamples/android-architecture-components/issues/44","id":233424717,"node_id":"MDU6SXNzdWUyMzM0MjQ3MTc=","number":44,"title":"Using getValue() on LiveData returns null with Room","user":{"login":"idragon81","id":7294519,"node_id":"MDQ6VXNlcjcyOTQ1MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/7294519?v=4","gravatar_id":"","url":"https://api.github.com/users/idragon81","html_url":"https://github.com/idragon81","followers_url":"https://api.github.com/users/idragon81/followers","following_url":"https://api.github.com/users/idragon81/following{/other_user}","gists_url":"https://api.github.com/users/idragon81/gists{/gist_id}","starred_url":"https://api.github.com/users/idragon81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idragon81/subscriptions","organizations_url":"https://api.github.com/users/idragon81/orgs","repos_url":"https://api.github.com/users/idragon81/repos","events_url":"https://api.github.com/users/idragon81/events{/privacy}","received_events_url":"https://api.github.com/users/idragon81/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-06-04T10:22:03Z","updated_at":"2018-10-11T20:48:41Z","closed_at":"2017-06-08T00:50:15Z","author_association":"NONE","body":"I have a POJO set up for use with Room and retrofit\r\n\r\n    @TypeConverters(DateConverter.class)\r\n    @Entity(indices = {@Index(\"code\")})\r\n    public class HealthcareCenter {\r\n        @PrimaryKey\r\n        @SerializedName(\"id\")\r\n        private int id;\r\n        @SerializedName(\"code\")\r\n        private String code;\r\n        @SerializedName(\"name\")\r\n        private String name;\r\n        @SerializedName(\"address\")\r\n        private String address;\r\n        @SerializedName(\"phone\")\r\n        private String phone;\r\n        @SerializedName(\"email\")\r\n        private String email;\r\n        @ColumnInfo(name = \"visited_date\")\r\n        @SerializedName(\"visited_date\")\r\n        private Date visited_date;\r\n        ....  //Getters and setters omitted here\r\n    }\r\n \r\nAnd have the following method in my Dao\r\n\r\n    @Query(\"select * from HealthcareCenter where code = :code\")\r\n    LiveData<HealthcareCenter> getCenterbyCode(String code);\r\n\r\nHowever when using \r\n    \r\n     db.healthcareCenterDao().getCenterByCode(code).getValue()\r\nthe method returns null.\r\n\r\nAs a workaround I am omitting the LiveData when I want to retrieve the value once and want to update it (Using an observer leads to a loop).\r\n\r\nDao\r\n     \r\n       @Query(\"select * from HealthcareCenter where code = :code\")\r\n       HealthcareCenter getNonObservableCenterbyCode(String code);\r\nUse\r\n    \r\n     HealthcareCenter healthcareCenter = db.healthcareCenterDao().getNonObservableCenterbyCode(qrCode.getCenter_code());"},"comment":{"url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/comments/429113177","html_url":"https://github.com/googlesamples/android-architecture-components/issues/44#issuecomment-429113177","issue_url":"https://api.github.com/repos/googlesamples/android-architecture-components/issues/44","id":429113177,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTExMzE3Nw==","user":{"login":"pedrovarela86","id":5798073,"node_id":"MDQ6VXNlcjU3OTgwNzM=","avatar_url":"https://avatars2.githubusercontent.com/u/5798073?v=4","gravatar_id":"","url":"https://api.github.com/users/pedrovarela86","html_url":"https://github.com/pedrovarela86","followers_url":"https://api.github.com/users/pedrovarela86/followers","following_url":"https://api.github.com/users/pedrovarela86/following{/other_user}","gists_url":"https://api.github.com/users/pedrovarela86/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrovarela86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrovarela86/subscriptions","organizations_url":"https://api.github.com/users/pedrovarela86/orgs","repos_url":"https://api.github.com/users/pedrovarela86/repos","events_url":"https://api.github.com/users/pedrovarela86/events{/privacy}","received_events_url":"https://api.github.com/users/pedrovarela86/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T20:48:41Z","updated_at":"2018-10-11T20:48:41Z","author_association":"NONE","body":"> you cannot receive sync data as room does not allow on main thread. .Dude!! I suggest you to read document yourself before commenting whatever, google it, buy books, do whatever but commenting shit.. thank you. \r\n\r\n"}}
{"actor":{"display_login":"pedrovarela86"}}