android--General Registration page implementation (no function)

Source: Internet
Author: User
Tags gettext

Reg.xml

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:paddi ngbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/activity_horizontal_margin" Android: paddingright= "@dimen/activity_horizontal_margin" android:paddingtop= "@dimen/activity_vertical_margin" tools: Context= ".        Registeractivity "> <textview android:id=" @+id/textview2 "android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:text= "@string/hello_world"/> <textview android:id= " @+id/tvusername "android:layout_width=" wrap_content "android:layout_height=" Wrap_content "Android:lay out_alignleft= "@+id/textview2" android:layout_aligntop= "@+id/textview2" android:text= "user name"/> <Text View android:id= "@+id/tvpassword" AndroidOid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignleft= "@+id/textView 2 "android:layout_below=" @+id/textview2 "android:layout_margintop=" 16DP "android:text=" Password "/> & Lt Radiogroup android:id= "@+id/rdsex" android:layout_width= "wrap_content" android:layout_height= "Wrap_co Ntent "android:layout_alignleft=" @+id/tvpassword "android:layout_below=" @+id/etpassword "Android:layo ut_margintop= "22DP" > <radiobutton android:id= "@+id/man" android:layout_width= "Wrap_con                 Tent "android:layout_height=" Wrap_content "android:checked=" true "android:text=" male "/> <radiobutton android:id= "@+id/woman" android:layout_width= "Wrap_content" android:l        ayout_height= "Wrap_content" android:layout_aligntop= "@+id/rdsex" android:layout_centerhorizontal= "true" android:text= "female"/> </RadioGroup> <checkbox android:id= "@+id/cb_hb_std" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_alignleft= "@+id/rdsex" android:layout_below= "@+id /rdsex "android:layout_margintop=" 30DP "android:text=" learning "/> <textview android:id=" @+id/text VIEW3 "android:layout_width=" wrap_content "android:layout_height=" Wrap_content "android:layout_above=        "@+id/cb_hb_photo" android:layout_alignleft= "@+id/cb_hb_std" android:text= "hobby"/> <textview        Android:id= "@+id/textview4" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" android:layout_alignleft= "@+id/cb_hb_std" android:layout_below= "@+id/cb_hb_std" android:layout_margintop= "19 DP "android:text=" age "/> <spinner android:id=" @+id/spinnerage "android:layout_width=" Wrap_co Ntent "Android:layout_height= "Wrap_content" android:layout_alignleft= "@+id/textview4" android:layout_below= "@+id/textView4" android:layout_margintop= "23DP"/> <imageview android:id= "@+id/imageview1" Android:layout_wid Th= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignleft= "@+id/cb_hb_slp" Android oid:layout_aligntop= "@+id/spinnerage" android:src= "@drawable/ic_launcher"/> <progressbar android:i D= "@+id/pb" style= "Android:attr/progressbarstylelarge" android:layout_width= "Wrap_content" android:l        ayout_height= "Wrap_content" android:layout_above= "@+id/textview3" android:layout_toleftof= "@+id/cb_hb_slp" android:visibility= "Gone"/> <button android:id= "@+id/btncon" android:layout_width= "Wrap_cont Ent "android:layout_height=" wrap_content "android:layout_alignleft=" @+id/spinnerage "android:layout_a Lignparentbottom= "true"       android:text= "Confirm"/> <checkbox android:id= "@+id/cb_hb_photo" android:layout_width= "Wrap_cont Ent "android:layout_height=" wrap_content "android:layout_above=" @+id/textview4 "Android:layout_alignr ight= "@+id/etregusername" android:layout_marginright= "44DP" android:text= "photography"/> <checkbox A Ndroid:id= "@+id/cb_hb_slp" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" a Ndroid:layout_above= "@+id/textview4" android:layout_marginright= "18DP" android:layout_toleftof= "@+id/cb_hb_p Hoto "android:text=" Sleep "/> <textview android:id=" @+id/textview1 "android:layout_width=" Wrap_ Content "android:layout_height=" wrap_content "android:layout_alignleft=" @+id/rdsex "Android:layout_be low= "@+id/etpassword" android:text= "gender"/> <edittext android:id= "@+id/etregusername" Android : Layout_width= "Wrap_contEnt "android:layout_height=" wrap_content "android:layout_aligntop=" @+id/tvusername "android:layout_to        rightof= "@+id/cb_hb_std" android:ems= "ten" > <requestfocus/> </EditText> <edittext        Android:id= "@+id/etpassword" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_alignbaseline= "@+id/tvpassword" android:layout_alignbottom= "@+id/tvpassword" android:l        ayout_alignleft= "@+id/etregusername" android:layout_alignright= "@+id/etregusername" android:ems= "10" Android:inputtype= "Textpassword"/></relativelayout>

Regsucc.xml

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:paddi ngbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/activity_horizontal_margin" Android: paddingright= "@dimen/activity_horizontal_margin" android:paddingtop= "@dimen/activity_vertical_margin" tools: Context= ".        Regsuccactivity "> <textview android:id=" @+id/textview2 "android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:text= "@string/hello_world"/> <textview android:id= "@ +id/cfname "android:layout_width=" wrap_content "android:layout_height=" Wrap_content "android:layout_a        lignleft= "@+id/textview2" android:layout_aligntop= "@+id/textview2" android:text= "1"/> <TextView Android:id= "@+id/cfsex" Android:layout_Width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignleft= "@+id/textView2" a         ndroid:layout_below= "@+id/textview2" android:text= "TextView"/> <textview android:id= "@+id/cfHobby" Android:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignleft= "@ +id/cfsex "android:layout_below=" @+id/cfsex "android:layout_margintop=" 28DP "android:text=" TextView " /> <textview android:id= "@+id/cfspinner" android:layout_width= "Wrap_content" Android:layout_ height= "Wrap_content" android:layout_alignleft= "@+id/cfhobby" android:layout_below= "@+id/cfHobby" and roid:layout_margintop= "33DP" android:text= "TextView"/></relativelayout>

  

Regiseractivity.java

public class Registeractivity extends Activity {private EditText etregusername;private radiogroup rgsex;private Button BT Ncon;private Spinner spinnerage;private ProgressBar pb;private checkbox cb1;private checkbox cb2;private checkbox cb3; Private list<checkbox> CheckBoxList = new arraylist<checkbox> (), @Overrideprotected void OnCreate (Bundle Savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_register); List<string> listage=new arraylist<string> () listage.add ("a") Listage.add ("20"); Listage.add ("+"); spinnerage= (Spinner) This.findviewbyid (r.id.spinnerage); Arrayadapter adapterage=new arrayadapter<string> (this,android. R.layout.simple_spinner_item,listage); Adapterage.setdropdownviewresource (Android. R.layout.simple_spinner_dropdown_item); Spinnerage.setadapter (adapterage); btncon= (Button) this.findViewById ( R.id.btncon);p b= (ProgressBar) This.findviewbyid (R.ID.PB); rgsex= (Radiogroup) Findviewbyid (r.id.rdsex); etRegUseRname= (EditText) Findviewbyid (r.id.etregusername) cb1= (checkbox) Findviewbyid (R.ID.CB_HB_SLP); cb2= (checkbox)        Findviewbyid (R.ID.CB_HB_STD); cb3= (CheckBox) Findviewbyid (R.id.cb_hb_photo); Checkboxlist.add (CB1);        Checkboxlist.add (CB2); Checkboxlist.add (CB3); Btncon.setonclicklistener (new View.onclicklistener () {@Overridepublic void OnClick (View arg0) {pb.setvisibility (view.visible); Toast.maketext (Registeractivity.this, "Success", Toast.length_long). Show (); Intent itregsuc=new Intent ( Registeractivity.this,regsuccactivity.class); String HB = ""; for (CheckBox checkbox:checkboxlist) {if (checkbox.ischecked ()) {h                    B+=checkbox.gettext (). toString () + ""; }} String Name=etregusername.gettext (). toString ();//bundle bundle=new Bundle ();//pass the name parameter to Tin yphp//bundle.putstring ("name", name);//Itregsuc.putextras (bundle); RadioButton rbsex= (RadioButton) Findviewbyid (Rgsex.getcheckedradiobuttonid ()); String sex=Rbsex.gettext (). toString (); String sp= (String) Spinnerage.getselecteditem (); Itregsuc.putextra ("name", name); Itregsuc.putextra ("Sex", sex); Itregsuc.putextra ("hobby", HB), Itregsuc.putextra ("spinner", SP); startactivity (ITREGSUC);}}); @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (R.menu.register, menu); return true;}}

Regsuccactivity.java

public class Regsuccactivity extends Activity {private TextView cfname;private TextView cfsex;private TextView CFHOBBY;PR Ivate TextView cfspinner; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Setcontentview (R.LAYOUT.ACTIVITY_RSG_SUCC);//bundle Bundle = This.getintent (). GetExtras ();// String name=bundle.getstring ("name"); Intent it=getintent (); String Name=it.getstringextra ("name"); String Sex=it.getstringextra ("sex"); String Hb=it.getstringextra ("hobby"); String Spinner=it.getstringextra ("Spinner"), Cfname= (TextView) Findviewbyid (r.id.cfname); cfsex= (TextView) Findviewbyid (R.id.cfsex); cfspinner= (TextView) Findviewbyid (R.id.cfspinner); cfhobby= (TextView) Findviewbyid ( R.id.cfhobby); Cfname.settext (name); Cfsex.settext (sex); Cfhobby.settext (HB); Cfspinner.settext (spinner);} @Overridepublic boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu; This adds items to the action bar if it is PR Esent.getmenuinflater (). Inflate (r.menu.rsg_succ, menu); return trUE;}} 

  

android--General Registration page implementation (no function)

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.