Android Phone Defender's Confirmation password dialog box _android

Source: Internet
Author: User

This article then implements the "Confirm password" function, that is, the user has previously set the password, now only need to enter a confirmation password

Layout files and "Android phone defender--Set Password dialog" in the layout is basically similar, all copy, change a little bit of detail will be done:

 <?xml version= "1.0" encoding= "Utf-8"?> <linearlayout "xmlns:android="
 Schemas.android.com/apk/res/android "android:layout_width=" match_parent "android:layout_height=" Match_parent " android:orientation= "vertical" > <textview style= "@style/titlestyle" android:background= "#f00" android:text= " Confirm Password "/> <edittext android:id=" @+id/et_confirm_psd android:layout_width= "Match_parent" android:layout_height = "Wrap_content" android:hint= "Confirm password"/> <linearlayout android:layout_width= "Match_parent" Android:layout_heigh t= "Wrap_content" > <button android:id= "@+id/bt_submit" android:layout_width= "0DP" android:layout_height= "wrap _content "android:layout_weight=" 1 "android:text=" confirmation "/> <button android:id=" @+id/bt_cancel "Android:layout_wi Dth= "0DP" android:layout_height= "Wrap_content" android:layout_weight= "1" android:text= "Cancel"/> </LinearLayout&

Gt </LinearLayout> 

Code logic is basically similar, and simple to modify

 /** * Confirm Password dialog box */private void Showconfirmpsddialog () {//need to define the display style of dialog box, so call Dialog.setview (view);
 Builder Builder = new Builder (this);
 Final Alertdialog Dialog = Builder.create ();
 Final View view = Inflate (this, r.layout.dialog_confirm_psd, null);
 Let the dialog box display a dialog box with its own definition of the interface effect 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 (New Onclicklistener () {@Override public void OnClick (View v) {EditText et_confirm_psd =
 (EditText) View.findviewbyid (R.ID.ET_CONFIRM_PSD);
 String confirmpsd = Et_confirm_psd.gettext (). toString ();
 String psd = sputil.getstring (Getapplicationcontext (), CONSTANTVALUE.MOBILE_SAFE_PSD, ""); if (! Textutils.isempty (CONFIRMPSD)) {//Enter user mobile phone anti-theft module if (psd.equals (CONFIRMPSD)) {Intent Intent = new Intent (getapplicationc
  Ontext (), testactivity.class);
  StartActivity (Intent);
Jump to the new interface after the need to hide the dialog box Dialog.dismiss ();  else {toastutil.show (Getapplicationcontext (), "Input password error");
 }else{///Prompt user password input is empty toastutil.show (Getapplicationcontext (), "Please enter password");
 }
 }
 });
 Bt_cancel.setonclicklistener (New Onclicklistener () {@Override public void OnClick (view view) {Dialog.dismiss ();
 }
 });
 }

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.