Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:15:55+00:00 2026-06-10T05:15:55+00:00

I managed to capture when a Switch View is clicked so the main activity

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:15:57+00:00Added an answer on June 10, 2026 at 5:15 am

    Having previously implemented the Switch button adding

    android:onClick="onSwitchClicked"
    

    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:

    powerSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if(isChecked){
                        //code
                    }else{
                        //code
                    }
                }
            });
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I managed to request the publish_actions permission, but since it is revocable from the
I managed to found out how to delete field but I have a problem
I managed to get the YUI calendar widget working fine. But When it displays
just now I was trying to capture the F1 key on the form, but
I have a view that creates a new core data managed object, and fills
I managed to register my app as camera app via <activity android:name=.CameraActivity android:clearTaskOnLaunch=true> <intent-filter>
I managed to set marker colors for individual markers { y: 5, marker: {
I managed to create a dynamic three dropdown list using Javascript code and it
I managed to apply this excellent example to my needs: http://code.google.com/p/galleriffic/issues/attachmentText?id=76&aid=-3045121742886940548&name=example-2.html&token=4nlvmgAfVpc5whcXC9UEqHZaSz0%3A1339257750721 With a small
The Managed Extensibility Framework (MEF) and Managed AddIn Framework (MAF, aka System.AddIn) seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.