Android phone Defender--Dialogue initial password verification process

Source: Internet
Author: User

This article implements the logical judgment of setting the password dialog box

This article address: http://www.cnblogs.com/wuyudong/p/5940551.html, reprint please indicate the source.

First, add the Listener event code for the button

   /*** Set Password dialog box*/    Private voidShowsetpsddialog () {//You need to define the display style of the dialog, so call Dialog.setview (view);       Builder builder = new Builder (this);         Final alertdialog dialog = builder.create ();         Final View view = Inflate (This, R.LAYOUT.DIALOG_SET_PSD, null); //Let the dialog box display a dialog interface effect that you define yourself Dialog.setview (view);        Dialog.show (); Button Bt_submit=(Button) view. Findviewbyid (R.id.bt_submit); Button Bt_cancel=(Button) view. Findviewbyid (R.id.bt_cancel); Bt_submit.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View v) {EditText et_set_psd=(EditText) view. Findviewbyid (R.ID.ET_SET_PSD); EditText ET_CONFIRM_PSD=(EditText) view. Findviewbyid (R.ID.ET_CONFIRM_PSD); String PSD=Et_set_psd.gettext (). toString (); String CONFIRMPSD=Et_confirm_psd.gettext (). toString (); if(! Textutils.isempty (PSD) &&!Textutils.isempty (CONFIRMPSD)) {                    //Enter the user mobile phone anti-theft module                    if(Psd.equals (CONFIRMPSD)) { Intent Intent = new Intent (Getapplicationcontext (), testactivity.                         Class);                        StartActivity (Intent); //go to the new interface to hide the dialog boxDialog.dismiss (); } Else{toastutil.show (Getapplicationcontext (),"Password Inconsistent"); }                }Else{                    //to prompt the user for password entry is emptyToastutil.show (Getapplicationcontext (), "Please enter password");        }            }        }); Bt_cancel.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (view view) {Dialog.dismiss ();    }        }); }

Here to create a new activity:testactivity for testing, first see the effect, and then implement the specific

 Public class extends Activity {    @Override    protectedvoid  onCreate (Bundle savedinstancestate) {         Super . OnCreate (savedinstancestate);         New TextView (this);        Textview.settext ("testactivity!" );        Setcontentview (TextView);    }}

Then add the following code to the manifest file:

<android:name= "com.wuyudong.mobilesafe.activity.testActivity"></  activity>

Android phone Defender--Dialogue initial password verification process

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.