{"action":"created","issue":{"url":"https://api.github.com/repos/haxenme/nme/issues/325","repository_url":"https://api.github.com/repos/haxenme/nme","labels_url":"https://api.github.com/repos/haxenme/nme/issues/325/labels{/name}","comments_url":"https://api.github.com/repos/haxenme/nme/issues/325/comments","events_url":"https://api.github.com/repos/haxenme/nme/issues/325/events","html_url":"https://github.com/haxenme/nme/issues/325","id":160930473,"node_id":"MDU6SXNzdWUxNjA5MzA0NzM=","number":325,"title":"Android - crash when clearing text and switching textfields","user":{"login":"hoseyjoe","id":2074385,"node_id":"MDQ6VXNlcjIwNzQzODU=","avatar_url":"https://avatars1.githubusercontent.com/u/2074385?v=4","gravatar_id":"","url":"https://api.github.com/users/hoseyjoe","html_url":"https://github.com/hoseyjoe","followers_url":"https://api.github.com/users/hoseyjoe/followers","following_url":"https://api.github.com/users/hoseyjoe/following{/other_user}","gists_url":"https://api.github.com/users/hoseyjoe/gists{/gist_id}","starred_url":"https://api.github.com/users/hoseyjoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoseyjoe/subscriptions","organizations_url":"https://api.github.com/users/hoseyjoe/orgs","repos_url":"https://api.github.com/users/hoseyjoe/repos","events_url":"https://api.github.com/users/hoseyjoe/events{/privacy}","received_events_url":"https://api.github.com/users/hoseyjoe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-17T16:51:20Z","updated_at":"2018-09-23T20:35:47Z","closed_at":null,"author_association":"NONE","body":"To repeat the crash you need to compile to android.  Enter text in field 1 and in field 2 and hit the circle 2 or more times.  The 13 in the error below is how many characters I had entered into to field 1 before clicking the circle.  I believe what is happening is that when the focus is forced back into text1 it assumes there are 13 characters and it is trying to set the focus at the end of those 13 characters  even though the text was removed on the first circle click.\n\nAndroidRuntime: java.lang.IndexOutOfBoundsException: setSpan (13 ... 13) ends beyond length 0\nAndroidRuntime:     at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1090)\n\n```\npackage;\n\nimport flash.events.MouseEvent;\nimport nme.display.Sprite;\nimport nme.text.TextField;\nimport nme.text.TextFieldType;\nimport nme.Lib;\nclass Main extends Sprite {\n    var text1:TextField;\n    var text2:TextField;\n    public function new() {\n        super();\n        this.scaleX = this.scaleY = 5;\n        text1 = new TextField();\n        text1.type = TextFieldType.INPUT;\n        text1.border = true;\n        text2 = new TextField();\n        text2.type = TextFieldType.INPUT;\n        this.addChild(text1);\n        this.addChild(text2);\n        text2.y = text1.height;\n        text2.border = true;\n\n        var square:Sprite = new Sprite();\n        square.graphics.beginFill(0, 1);\n        square.graphics.drawCircle(150, 50, 10);\n        square.graphics.endFill();\n        square.addEventListener(MouseEvent.CLICK, doIt);\n        this.addChild(square);\n    }\n    var cnt:Int = 0;\n    function doIt(e){\n        if (cnt == 0){\n            text1.text = \"\";\n            stage.focus = text2;            \n            cnt = 1;\n        }else{\n            stage.focus = text1;\n            text2.text = \"\";\n            cnt = 0;\n        }\n    }\n\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/haxenme/nme/issues/comments/423845947","html_url":"https://github.com/haxenme/nme/issues/325#issuecomment-423845947","issue_url":"https://api.github.com/repos/haxenme/nme/issues/325","id":423845947,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzg0NTk0Nw==","user":{"login":"thomasuster","id":220965,"node_id":"MDQ6VXNlcjIyMDk2NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/220965?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasuster","html_url":"https://github.com/thomasuster","followers_url":"https://api.github.com/users/thomasuster/followers","following_url":"https://api.github.com/users/thomasuster/following{/other_user}","gists_url":"https://api.github.com/users/thomasuster/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasuster/subscriptions","organizations_url":"https://api.github.com/users/thomasuster/orgs","repos_url":"https://api.github.com/users/thomasuster/repos","events_url":"https://api.github.com/users/thomasuster/events{/privacy}","received_events_url":"https://api.github.com/users/thomasuster/received_events","type":"User","site_admin":false},"created_at":"2018-09-23T20:35:47Z","updated_at":"2018-09-23T20:35:47Z","author_association":"MEMBER","body":"Confirmed on latest NME\r\n```\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: FATAL EXCEPTION: main\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: Process: io.nme.samples.nyancat, PID: 32574\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: java.lang.IndexOutOfBoundsException: setSpan (4 ... 4) ends beyond length 0\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1090)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:665)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:658)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.text.Selection.setSelection(Selection.java:76)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.text.Selection.setSelection(Selection.java:87)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.widget.EditText.setSelection(EditText.java:98)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat org.haxe.nme.GameActivity$7.run(GameActivity.java:1132)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.os.Handler.handleCallback(Handler.java:739)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.os.Looper.loop(Looper.java:148)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat android.app.ActivityThread.main(ActivityThread.java:5417)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat java.lang.reflect.Method.invoke(Native Method)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\r\n09-23 13:35:13.252 32574 32574 E AndroidRuntime: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\r\n09-23 13:35:13.253   778   950 W ActivityManager:   Force finishing activity io.nme.samples.nyancat/.MainActivity\r\n```"}}
{"actor":{"display_login":"thomasuster"}}