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

  • Home
  • SEARCH
  • 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 7690083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:18:56+00:00 2026-05-31T20:18:56+00:00

I have implemented an application with multiple check boxes with multiple layouts.I am invisible

  • 0

I have implemented an application with multiple check boxes with multiple layouts.I am invisible the layouts when user unchecked the related check box.then i am trying to save the content and settings when user re-launch the application.

I have implemented code as follows:

public class MultipleControllsActivity extends Activity {
/** Called when the activity is first created. */

LinearLayout l1,l2,l3;



@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    l1 = ((LinearLayout)findViewById(R.id.linearLayout1));
    l2 = ((LinearLayout)findViewById(R.id.linearLayout2));
    l3 = ((LinearLayout)findViewById(R.id.linearLayout3));

    ((CheckBox)findViewById(R.id.checkBox1)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            if(!isChecked){
            l1.setVisibility(View.GONE);    
            }
        }
    });


    ((CheckBox)findViewById(R.id.checkBox2)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            l2.setVisibility(View.GONE);
        }
    });


    ((CheckBox)findViewById(R.id.checkBox3)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            l3.setVisibility(View.GONE);
        }
    });


    ((Button)findViewById(R.id.saveTemp)).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            //Save the content code here

        }
    });

}

}

When i click on the saveTemp button then i would like to save the content and if user re-launch the application then the saved content will be appear.

please any body help me…

  • 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-31T20:18:58+00:00Added an answer on May 31, 2026 at 8:18 pm

    You can use

    SharedPreferences

    http://developer.android.com/reference/android/content/SharedPreferences.html

    Use This :–

         public class MultipleControllsActivity extends Activity {
        /** Called when the activity is first created. */
    
        LinearLayout l1,l2,l3;
    
    
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
         SharedPreferences pref_settings;
        pref_settings = getSharedPreferences("DATA", Context.MODE_PRIVATE);
            l1 = ((LinearLayout)findViewById(R.id.linearLayout1));
            l2 = ((LinearLayout)findViewById(R.id.linearLayout2));
            l3 = ((LinearLayout)findViewById(R.id.linearLayout3));
    l1.setVisibility(pref_settings.getInt("l1", 0));
    l2.setVisibility(pref_settings.getInt("l2", 0));
    l2.setVisibility(pref_settings.getInt("l3", 0));
    
            ((CheckBox)findViewById(R.id.checkBox1)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    
                    if(!isChecked){
                    l1.setVisibility(View.GONE);    
                    }
                }
            });
    
    
            ((CheckBox)findViewById(R.id.checkBox2)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    
                    l2.setVisibility(View.GONE);
                }
            });
    
    
            ((CheckBox)findViewById(R.id.checkBox3)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    
                    l3.setVisibility(View.GONE);
                }
            });
    
    
            ((Button)findViewById(R.id.saveTemp)).setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
    
                    SharedPreferences pref_settings;
        pref_settings = getSharedPreferences("DATA", Context.MODE_PRIVATE);
                SharedPreferences.Editor editor = pref_settings.edit();
    
    
                    editor.putInt("l1", l1.getVisibility());
        editor.putInt("l2", l2.getVisibility());
        editor.putInt("l3", l3.getVisibility());
    
                    editor.commit();
    
                }
            });
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Very simple Qt GUI application: On the scene I have multiple circles implemented as
I have implemented a combo box which has a check box in it (Windows
I have implemented lucene for my application and it works very well unless you
We have implemented SSO in a .NET web application using Windows Identity Foundation (WIF).
I have a .NET 3.5 web application for which I have implemented a class
I have a small application in C#, and so far I have implemented it
In our desktop application, we have implemented a simple search engine using an inverted
I have a VB6 application implemented as an ActiveX exe. I also have a
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
I have successfully implemented SUBSONIC DAL in my desktop application. it was superb experience.

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.