{"action":"created","issue":{"url":"https://api.github.com/repos/zserge/anvil/issues/16","labels_url":"https://api.github.com/repos/zserge/anvil/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/zserge/anvil/issues/16/comments","events_url":"https://api.github.com/repos/zserge/anvil/issues/16/events","html_url":"https://github.com/zserge/anvil/issues/16","id":82851627,"number":16,"title":"Manually getting a view","user":{"login":"corbt","id":176426,"avatar_url":"https://avatars.githubusercontent.com/u/176426?v=3","gravatar_id":"","url":"https://api.github.com/users/corbt","html_url":"https://github.com/corbt","followers_url":"https://api.github.com/users/corbt/followers","following_url":"https://api.github.com/users/corbt/following{/other_user}","gists_url":"https://api.github.com/users/corbt/gists{/gist_id}","starred_url":"https://api.github.com/users/corbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corbt/subscriptions","organizations_url":"https://api.github.com/users/corbt/orgs","repos_url":"https://api.github.com/users/corbt/repos","events_url":"https://api.github.com/users/corbt/events{/privacy}","received_events_url":"https://api.github.com/users/corbt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-05-30T16:18:29Z","updated_at":"2015-06-02T10:05:23Z","closed_at":null,"body":"Ok, so I need to manually get a view from a layout managed by Anvil. I have a TextureView that I need to hook up to the camera. The view I need is always visible in the activity, so Anvil should always render it. Currently what I'm trying is based on a technique described [here](http://stackoverflow.com/questions/8937380/how-to-set-id-of-dynamic-created-layout):\r\n\r\n```kotlin\r\nv<AutoFitTextureView> {\r\n    -size(FILL, 400)\r\n    -id(R.id.camera_preview)\r\n}\r\n```\r\n\r\nAnd then later on, still within `onCreate`:\r\n\r\n```kotlin\r\nmTextureView = findViewById(R.id.camera_preview) as AutoFitTextureView\r\n```\r\n\r\nbut Android isn't able to find the view (`findViewById` returns null). Is there a better way to capture a reference to a view object than what I'm doing here? I think the ideal would be to implement something similar to React's [refs](https://facebook.github.io/react/docs/more-about-refs.html), but I'd be happy with a workaround."},"comment":{"url":"https://api.github.com/repos/zserge/anvil/issues/comments/107905556","html_url":"https://github.com/zserge/anvil/issues/16#issuecomment-107905556","issue_url":"https://api.github.com/repos/zserge/anvil/issues/16","id":107905556,"user":{"login":"corbt","id":176426,"avatar_url":"https://avatars.githubusercontent.com/u/176426?v=3","gravatar_id":"","url":"https://api.github.com/users/corbt","html_url":"https://github.com/corbt","followers_url":"https://api.github.com/users/corbt/followers","following_url":"https://api.github.com/users/corbt/following{/other_user}","gists_url":"https://api.github.com/users/corbt/gists{/gist_id}","starred_url":"https://api.github.com/users/corbt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corbt/subscriptions","organizations_url":"https://api.github.com/users/corbt/orgs","repos_url":"https://api.github.com/users/corbt/repos","events_url":"https://api.github.com/users/corbt/events{/privacy}","received_events_url":"https://api.github.com/users/corbt/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T10:05:23Z","updated_at":"2015-06-02T10:05:23Z","body":"What about the case where you change the state so the view is removed, and then change it again so the view comes back? Will the callback be called the second time?"}}