{"action":"created","issue":{"url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/70","repository_url":"https://api.github.com/repos/evant/binding-collection-adapter","labels_url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/70/comments","events_url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/70/events","html_url":"https://github.com/evant/binding-collection-adapter/issues/70","id":185983842,"number":70,"title":"Listen a switch inside each row of listview","user":{"login":"brunoudi","id":16839854,"avatar_url":"https://avatars.githubusercontent.com/u/16839854?v=3","gravatar_id":"","url":"https://api.github.com/users/brunoudi","html_url":"https://github.com/brunoudi","followers_url":"https://api.github.com/users/brunoudi/followers","following_url":"https://api.github.com/users/brunoudi/following{/other_user}","gists_url":"https://api.github.com/users/brunoudi/gists{/gist_id}","starred_url":"https://api.github.com/users/brunoudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brunoudi/subscriptions","organizations_url":"https://api.github.com/users/brunoudi/orgs","repos_url":"https://api.github.com/users/brunoudi/repos","events_url":"https://api.github.com/users/brunoudi/events{/privacy}","received_events_url":"https://api.github.com/users/brunoudi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-28T17:58:59Z","updated_at":"2016-10-28T18:08:42Z","closed_at":null,"body":"I'm having some difficult to listen a switch \"onCheckedChanged\", which is inside a row in a list view. \r\n\r\nFrom my activity I populate the list view:\r\n```java\r\n    private ActivityDevicesBinding mBinding;\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_devices);\r\n        ViewModel model = new ViewModel();\r\n         //populate the model\r\n        mBinding.setViewModel(model);\r\n    }\r\n```\r\nMy \"activity_devices.xml\" layout:\r\n```xml\r\n<ImageView \r\n    android:onClick=\"@{modelItem.clickOnOff}\"\r\n    'some layout parameters'  />\r\n\r\n<Switch\r\n    android:onCheckedChanged=\"@{modelItem.changeSwitch}\"\r\n    'some layout parameters'  />\r\n```\r\nAnd this is from my model object class:\r\n```java\r\n    public final View.OnClickListener clickOnOff = new View.OnClickListener() {\r\n        @Override\r\n        public void onClick(View v) {\r\n            //do some stuff with this object\r\n        }\r\n    };\r\n\r\n\r\n    public final CompoundButton.OnCheckedChangeListener changeSwitch = new CompoundButton.OnCheckedChangeListener() {\r\n        @Override\r\n        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\r\n            //do some stuff with this object\r\n        }\r\n    };\r\n```\r\nMy problem is I can't do like this in the xml file for the switch, and I don't know how to attach the listener for it in each row. The ImageView onClick listener is working well."},"comment":{"url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/comments/256989290","html_url":"https://github.com/evant/binding-collection-adapter/issues/70#issuecomment-256989290","issue_url":"https://api.github.com/repos/evant/binding-collection-adapter/issues/70","id":256989290,"user":{"login":"evant","id":628930,"avatar_url":"https://avatars.githubusercontent.com/u/628930?v=3","gravatar_id":"","url":"https://api.github.com/users/evant","html_url":"https://github.com/evant","followers_url":"https://api.github.com/users/evant/followers","following_url":"https://api.github.com/users/evant/following{/other_user}","gists_url":"https://api.github.com/users/evant/gists{/gist_id}","starred_url":"https://api.github.com/users/evant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evant/subscriptions","organizations_url":"https://api.github.com/users/evant/orgs","repos_url":"https://api.github.com/users/evant/repos","events_url":"https://api.github.com/users/evant/events{/privacy}","received_events_url":"https://api.github.com/users/evant/received_events","type":"User","site_admin":false},"created_at":"2016-10-28T18:08:42Z","updated_at":"2016-10-28T18:08:42Z","body":"If you have a list of ViewModel, it should work exactly the same. Sorry, I'm confused on what the issue is. Your sample code does not show any list or use of this lib."}}
{"actor":{"display_login":"evant"}}