Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RegisterActivity extends Activity {
- String url = ServerUrl.assignRollNumber;
- LoginDataBaseAdapter loginDataBaseAdapter;
- //EditText editTextUserName,editTextPassword,editTextConfirmPassword,editTextEmail,editTextPhone;
- Button btnCreateAccount;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.register);
- loginDataBaseAdapter=new LoginDataBaseAdapter(this);
- loginDataBaseAdapter=loginDataBaseAdapter.open();
- final EditText editTextUserName=(EditText)findViewById(R.id.editTextUserName);
- final EditText editTextPassword=(EditText)findViewById(R.id.editTextPassword);
- final EditText editTextConfirmPassword=(EditText)findViewById(R.id.editTextConfirmPassword);
- final EditText editTextEmail = (EditText)findViewById(R.id.editTextEmail);
- final EditText editTextPhone = (EditText) findViewById(R.id.editTextPhone);
- btnCreateAccount=(Button)findViewById(R.id.buttonCreateAccount);
- btnCreateAccount.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- final String userName=editTextUserName.getText().toString();
- final String password=editTextPassword.getText().toString();
- final String emailid=editTextEmail.getText().toString();
- final String phone = editTextPassword.getText().toString();
- final String confirmPassword=editTextConfirmPassword.getText().toString();
- if(userName.equals("")||password.equals("")||confirmPassword.equals("")||emailid.equals("")||phone.equals(""))
- {
- Toast.makeText(getApplicationContext(), "Field Vaccant", Toast.LENGTH_LONG).show();
- return;
- }
- if(!password.equals(confirmPassword))
- {
- Toast.makeText(getApplicationContext(), "Password does not match", Toast.LENGTH_LONG).show();
- return;
- }
- else
- {
- final CharSequence[] items={"Email","Phone"};
- AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
- builder.setTitle("SEND USER DETAILS VIA");
- builder.setSingleChoiceItems(items,-1, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if("Email".equals(items[which]))
- {
- Toast.makeText(getApplicationContext(), "EMAIL SELECTED", Toast.LENGTH_LONG).show();
- }
- else if("Phone".equals(items[which]))
- {
- Toast.makeText(getApplicationContext(), "PHONE SELECTED", Toast.LENGTH_LONG).show();
- }
- }
- });
- builder.show();
- }
- }
- });
- TextView loginScreen = (TextView) findViewById(R.id.link_to_login);
- loginScreen.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View arg0) {
- finish();
- }
- });
- }}
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:fillViewport="true">
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#ffffff">
- <!-- Header Starts-->
- <LinearLayout android:id="@+id/header"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@layout/header_gradient">
- <!-- Logo Start-->
- <ImageView android:src="@drawable/headerlogo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- />
- <!-- Logo Ends -->
- </LinearLayout>
- <!-- Header Ends -->
- <!-- Footer Start -->
- <LinearLayout android:id="@+id/footer"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="45dip"
- android:background="@layout/footer_repeat"
- android:layout_alignParentBottom="true">
- </LinearLayout>
- <!-- Footer Ends -->
- <!-- Registration Form -->
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="10dip"
- android:layout_below="@id/header">
- <!-- Full Name Label -->
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="Full Name"/>
- <EditText android:id="@+id/editTextUserName"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:singleLine="true"
- android:layout_marginBottom="20dip"/>
- <!-- Password Label -->
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="Password"/>
- <EditText android:id="@+id/editTextPassword"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:password="true"
- android:singleLine="true"
- android:layout_marginBottom="20dip"/>
- <!-- Confirm Password Label -->
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="Confirm Password"/>
- <EditText android:id="@+id/editTextConfirmPassword"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:password="true"
- android:singleLine="true"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="5dip"/>
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="Email "/>
- <EditText android:id="@+id/editTextEmail"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="5dip"/>
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:textColor="#372c24"
- android:text="Phone "/>
- <EditText android:id="@+id/editTextPhone"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:numeric="integer"
- android:singleLine="true"
- android:layout_marginBottom="20dp"
- android:layout_marginTop="5dip"/>
- <!-- Register Button -->
- <Button android:id="@+id/buttonCreateAccount"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dip"
- android:text="Register New Account"/>
- <!-- Link to Login Screen -->
- <TextView android:id="@+id/link_to_login"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="30dip"
- android:layout_marginBottom="60dip"
- android:text="Already has account! Login here"
- android:gravity="center"
- android:textSize="20dip"
- android:textColor="#c63a29"/>
- </LinearLayout>
- <!-- Registration Form Ends -->
- </RelativeLayout>
- </ScrollView>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement