I managed to capture when a Switch View is clicked so the main activity responds accordingly; but whenever I slide it instead of clicking it’s as if nothing has happened. How can I detect this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Having previously implemented the Switch button adding
On my .xml manifest and adding the corresponding method to my main activity did not provide desired results; since as the question says it only worked when clicked. Noticed that it is better to do it this way:
This way, whenever the Switch’s state changes, regardless of sliding or clicking, the method will be called.
Refer to this tutorial for further information:
http://developer.android.com/guide/topics/ui/controls/togglebutton.html