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 6964275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:54:16+00:00 2026-05-27T15:54:16+00:00

I have to two Class in my App Setting(for saving the settings) main Class

  • 0

I have to two Class in my App

  1. Setting(for saving the settings)
  2. main Class

I defined the Toggle button and check box in Setting class for On and Off.
now when I call the setting class and from the main class and the change the checked state of Toggle Button and Check Box and the return to main class and if I again call the Setting class the checked state of the Toggle button and check box is not change it come back to it original state please help
My CODE:

yes.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if(((CheckBox) v).isChecked())
                sound.toggle();
        }
    });
    sound.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            Log.v("CheckBoxActivity", (isChecked ? "checked" : "not checked"));
          }
        });
      }

      public void doClick(View view) {
        Log.v("CheckBoxActivity", ((CheckBox) view).isChecked() ? "checked" : "not  checked");
      }
  • 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-05-27T15:54:16+00:00Added an answer on May 27, 2026 at 3:54 pm

    This probably will be the problem as each time your activity starts,it would take default selection state for the components.

    To achieve you goal,you need to store what state you need for a toggle button and checkbox.And then you will have to set the according state of the same each time you load activity,that mean in onCreate() just before you start defining onClick() on those components.

    You can use SharedPreference object to store state at a time and use the same in onCreate() of you activity to set stored states of toggle button and checkboxes.

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

Sidebar

Related Questions

I have two domains declared in my app. class Posts { String title String
i have a googlemap app that displays two items (itemizedoverlay class) and i have
I have two models: class User end class Message belongs_to :sender, :class_name=> 'User' belongs_to
I have two classes class A { public string something { get; set; }
I have two models: class Actor(models.Model): name = models.CharField(max_length=30, unique = True) event =
i have two models: class Category has many :jobs end class Job belongs_to :category
In Django, I have two models: class Product(models.Model): name = models.CharField(max_length = 50) categories
here is what my code looks like i have two forms: class Form_1 extends
I'm not very good in SQL and HQL... I have two domains: class Hotel
I have two entities: public class Parent() { public ICollection<Child> Children { get; set;

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.