{"action":"opened","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/3767","repository_url":"https://api.github.com/repos/realm/realm-java","labels_url":"https://api.github.com/repos/realm/realm-java/issues/3767/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/3767/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/3767/events","html_url":"https://github.com/realm/realm-java/issues/3767","id":188340565,"number":3767,"title":" io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: 0","user":{"login":"JoeBoeJoe","id":23268921,"avatar_url":"https://avatars.githubusercontent.com/u/23268921?v=3","gravatar_id":"","url":"https://api.github.com/users/JoeBoeJoe","html_url":"https://github.com/JoeBoeJoe","followers_url":"https://api.github.com/users/JoeBoeJoe/followers","following_url":"https://api.github.com/users/JoeBoeJoe/following{/other_user}","gists_url":"https://api.github.com/users/JoeBoeJoe/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeBoeJoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeBoeJoe/subscriptions","organizations_url":"https://api.github.com/users/JoeBoeJoe/orgs","repos_url":"https://api.github.com/users/JoeBoeJoe/repos","events_url":"https://api.github.com/users/JoeBoeJoe/events{/privacy}","received_events_url":"https://api.github.com/users/JoeBoeJoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-09T20:09:26Z","updated_at":"2016-11-09T20:09:26Z","closed_at":null,"body":"Started using Realm for few days , and it is great thing so far.\r\nI got two fragments, I want to pass data between EditText in fragment 1 and TextView in fragment 2.\r\n\r\nI have already seen some solutions here and StackOverflow, but none of them worked for me.and I am still getting error RealmPrimaryKeyConstraintException,\r\n\r\nThere is some problem with setting Primary key ID = 0, so I did try to set it to 5, but nothing worked for me.\r\n\r\nFragment 1:\r\n```\r\n @OnClick(R.id.btn_forgot)\r\n    public void onButtonClick() {\r\n    \r\n        Realm realm = getRealm();\r\n        realm.beginTransaction();\r\n\r\n           Email email1 = realm.createObject(Email.class) ;\r\n        email1.setUsername(editEmail.getText().toString());\r\n        realm.copyToRealmOrUpdate(email1);\r\n        realm.commitTransaction();\r\n    }\r\n\r\nFragment 2:\r\n\r\n\r\n  ```\r\n  @Override\r\n    public void onStart() {\r\n        super.onStart();\r\n\r\n        realm = getRealm();\r\n        RealmQuery<Email> query1 = realm.where(Email.class);\r\n        Email result1 = query1.findFirst();\r\n        resendTxt = (AutoResizeTextView) getView().findViewById(R.id.resend_txt) ;\r\n\r\n\r\n        if(resendTxt != null){\r\n            this.resendTxt.setText(result1.getUsername());\r\n        }\r\n\r\n\r\n    }\r\n\r\nModel:\r\n\r\n```\r\npublic class Email extends RealmObject {\r\n    @PrimaryKey\r\n    private int id = 0;\r\n    private String username;\r\n\r\n    public String getUsername() {\r\n        return username;\r\n    }\r\n    public void setUsername(String username) {\r\n        this.username = username;\r\n    }\r\n}\r\n```\r\n```\r\n```"}}
{"actor":{"display_login":"JoeBoeJoe"}}