Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.93 KB | None | 0 0
  1. public class RegisterActivity extends Activity {
  2.  
  3. String url = ServerUrl.assignRollNumber;
  4. LoginDataBaseAdapter loginDataBaseAdapter;
  5. //EditText editTextUserName,editTextPassword,editTextConfirmPassword,editTextEmail,editTextPhone;
  6. Button btnCreateAccount;
  7. @Override
  8.  
  9. public void onCreate(Bundle savedInstanceState) {
  10. super.onCreate(savedInstanceState);
  11. setContentView(R.layout.register);
  12. loginDataBaseAdapter=new LoginDataBaseAdapter(this);
  13. loginDataBaseAdapter=loginDataBaseAdapter.open();
  14.  
  15. final EditText editTextUserName=(EditText)findViewById(R.id.editTextUserName);
  16. final EditText editTextPassword=(EditText)findViewById(R.id.editTextPassword);
  17. final EditText editTextConfirmPassword=(EditText)findViewById(R.id.editTextConfirmPassword);
  18. final EditText editTextEmail = (EditText)findViewById(R.id.editTextEmail);
  19. final EditText editTextPhone = (EditText) findViewById(R.id.editTextPhone);
  20. btnCreateAccount=(Button)findViewById(R.id.buttonCreateAccount);
  21.  
  22. btnCreateAccount.setOnClickListener(new View.OnClickListener() {
  23. @Override
  24. public void onClick(View v) {
  25.  
  26. final String userName=editTextUserName.getText().toString();
  27. final String password=editTextPassword.getText().toString();
  28. final String emailid=editTextEmail.getText().toString();
  29. final String phone = editTextPassword.getText().toString();
  30. final String confirmPassword=editTextConfirmPassword.getText().toString();
  31. if(userName.equals("")||password.equals("")||confirmPassword.equals("")||emailid.equals("")||phone.equals(""))
  32. {
  33. Toast.makeText(getApplicationContext(), "Field Vaccant", Toast.LENGTH_LONG).show();
  34. return;
  35. }
  36. if(!password.equals(confirmPassword))
  37. {
  38. Toast.makeText(getApplicationContext(), "Password does not match", Toast.LENGTH_LONG).show();
  39. return;
  40. }
  41. else
  42. {
  43. final CharSequence[] items={"Email","Phone"};
  44. AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
  45. builder.setTitle("SEND USER DETAILS VIA");
  46.  
  47.  
  48.  
  49. builder.setSingleChoiceItems(items,-1, new DialogInterface.OnClickListener() {
  50.  
  51. @Override
  52. public void onClick(DialogInterface dialog, int which) {
  53.  
  54.  
  55. if("Email".equals(items[which]))
  56. {
  57. Toast.makeText(getApplicationContext(), "EMAIL SELECTED", Toast.LENGTH_LONG).show();
  58.  
  59. }
  60. else if("Phone".equals(items[which]))
  61. {
  62. Toast.makeText(getApplicationContext(), "PHONE SELECTED", Toast.LENGTH_LONG).show();
  63.  
  64. }
  65.  
  66.  
  67. }
  68. });
  69. builder.show();
  70.  
  71. }
  72. }
  73. });
  74. TextView loginScreen = (TextView) findViewById(R.id.link_to_login);
  75. loginScreen.setOnClickListener(new View.OnClickListener() {
  76. @Override
  77. public void onClick(View arg0) {
  78. finish();
  79. }
  80. });
  81. }}
  82.  
  83. <?xml version="1.0" encoding="utf-8"?>
  84. <ScrollView
  85. xmlns:android="http://schemas.android.com/apk/res/android"
  86. android:layout_width="fill_parent"
  87. android:layout_height="fill_parent"
  88. android:fillViewport="true">
  89. <RelativeLayout
  90. android:layout_width="fill_parent"
  91. android:layout_height="wrap_content" android:background="#ffffff">
  92.  
  93. <!-- Header Starts-->
  94. <LinearLayout android:id="@+id/header"
  95. android:layout_width="wrap_content"
  96. android:layout_height="wrap_content"
  97. android:background="@layout/header_gradient">
  98.  
  99. <!-- Logo Start-->
  100. <ImageView android:src="@drawable/headerlogo"
  101. android:layout_width="wrap_content"
  102. android:layout_height="wrap_content"
  103. />
  104. <!-- Logo Ends -->
  105. </LinearLayout>
  106. <!-- Header Ends -->
  107.  
  108. <!-- Footer Start -->
  109. <LinearLayout android:id="@+id/footer"
  110. android:orientation="horizontal"
  111. android:layout_width="fill_parent"
  112. android:layout_height="45dip"
  113. android:background="@layout/footer_repeat"
  114. android:layout_alignParentBottom="true">
  115. </LinearLayout>
  116. <!-- Footer Ends -->
  117.  
  118. <!-- Registration Form -->
  119. <LinearLayout
  120.  
  121. android:orientation="vertical"
  122. android:layout_width="match_parent"
  123. android:layout_height="wrap_content"
  124. android:padding="10dip"
  125. android:layout_below="@id/header">
  126. <!-- Full Name Label -->
  127. <TextView android:layout_width="fill_parent"
  128. android:layout_height="wrap_content"
  129. android:textColor="#372c24"
  130. android:text="Full Name"/>
  131. <EditText android:id="@+id/editTextUserName"
  132. android:layout_width="fill_parent"
  133. android:layout_height="wrap_content"
  134. android:layout_marginTop="5dip"
  135. android:singleLine="true"
  136. android:layout_marginBottom="20dip"/>
  137. <!-- Password Label -->
  138. <TextView android:layout_width="fill_parent"
  139. android:layout_height="wrap_content"
  140. android:textColor="#372c24"
  141. android:text="Password"/>
  142. <EditText android:id="@+id/editTextPassword"
  143. android:layout_width="fill_parent"
  144. android:layout_height="wrap_content"
  145. android:layout_marginTop="5dip"
  146. android:password="true"
  147. android:singleLine="true"
  148. android:layout_marginBottom="20dip"/>
  149. <!-- Confirm Password Label -->
  150. <TextView android:layout_width="fill_parent"
  151. android:layout_height="wrap_content"
  152. android:textColor="#372c24"
  153. android:text="Confirm Password"/>
  154. <EditText android:id="@+id/editTextConfirmPassword"
  155. android:layout_width="fill_parent"
  156. android:layout_height="wrap_content"
  157. android:password="true"
  158. android:singleLine="true"
  159. android:layout_marginBottom="20dp"
  160. android:layout_marginTop="5dip"/>
  161.  
  162. <TextView android:layout_width="fill_parent"
  163. android:layout_height="wrap_content"
  164. android:textColor="#372c24"
  165. android:text="Email "/>
  166.  
  167. <EditText android:id="@+id/editTextEmail"
  168. android:layout_width="fill_parent"
  169. android:layout_height="wrap_content"
  170.  
  171. android:singleLine="true"
  172. android:layout_marginBottom="20dp"
  173. android:layout_marginTop="5dip"/>
  174.  
  175. <TextView android:layout_width="fill_parent"
  176. android:layout_height="wrap_content"
  177. android:textColor="#372c24"
  178. android:text="Phone "/>
  179.  
  180. <EditText android:id="@+id/editTextPhone"
  181. android:layout_width="fill_parent"
  182. android:layout_height="wrap_content"
  183. android:numeric="integer"
  184. android:singleLine="true"
  185. android:layout_marginBottom="20dp"
  186. android:layout_marginTop="5dip"/>
  187.  
  188.  
  189. <!-- Register Button -->
  190. <Button android:id="@+id/buttonCreateAccount"
  191. android:layout_width="fill_parent"
  192. android:layout_height="wrap_content"
  193. android:layout_marginTop="20dip"
  194. android:text="Register New Account"/>
  195. <!-- Link to Login Screen -->
  196. <TextView android:id="@+id/link_to_login"
  197. android:layout_width="fill_parent"
  198. android:layout_height="wrap_content"
  199. android:layout_marginTop="30dip"
  200. android:layout_marginBottom="60dip"
  201. android:text="Already has account! Login here"
  202. android:gravity="center"
  203. android:textSize="20dip"
  204. android:textColor="#c63a29"/>
  205.  
  206. </LinearLayout>
  207. <!-- Registration Form Ends -->
  208. </RelativeLayout>
  209. </ScrollView>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement