Android mobile guard-business logic of navigation interface 4, android guard

Source: Internet
Author: User

Android mobile guard-business logic of navigation interface 4, android guard

This article implements the business logic of navigation interface 4. The navigation interface 4 is as follows:

For more information, see http://www.cnblogs.com/wuyudong/p/5952640.html.

The Code is as follows:

Private void initUI () {cb_box = (CheckBox) findViewById (R. id. cb_box); // 1, whether to display boolean open_security = SpUtil in the selected status. getBoolean (this, ConstantValue. OPEN_SECURITY, false); cb_box.setChecked (open_security); // 2. Based on the status, modify if (open_security) {cb_box.setText ("enabled Security Settings") in the subsequent text of the checkbox ");} else {cb_box.setText ("Security Settings disabled");} // 3. When you click this button, the selected state of the listener changes. cb_box.setOnCheckedChangeListener (new CompoundButton. onCheckedChangeListener () {@ Override public void onCheckedChanged (CompoundButton compoundButton, boolean B) {// 4. The status after isChecked is clicked. putBoolean (getApplicationContext (), ConstantValue. OPEN_SECURITY, B); // 5. Modify the displayed text if (B) {cb_box.setText ("Security Settings enabled") based on the enabled/disabled status ");} else {cb_box.setText ("Security Settings disabled") ;}}}); // 4. Status After isChecked is clicked, storing the status after clicking SpUtil. putBoolean (this, ConstantValue. OPEN_SECURITY, cb_box.isChecked ());}

Add logic to the next page. When the checkbox is not selected, click the button to bring up a reminder. The Code is as follows:

Public void nextPage (View view) {boolean open_security = SpUtil. getBoolean (this, ConstantValue. OPEN_SECURITY, false); if (open_security) {Intent intent = new Intent (getApplicationContext (), SetupOverActivity. class); startActivity (intent); finish (); SpUtil. putBoolean (this, ConstantValue. SETUP_OVER, true);} else {ToastUtil. show (this, "anti-theft protection must be enabled ");}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.