SHARE
TWEET

Untitled

a guest Jan 11th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.nir.nestleapp;
  2.  
  3. import android.content.Intent;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.EditText;
  9. import android.widget.TextView;
  10. import android.widget.Toast;
  11.  
  12. import org.w3c.dom.Text;
  13.  
  14. import java.util.jar.Attributes;
  15.  
  16. public class RegisterActivity extends AppCompatActivity {
  17. MyDBHandler db;
  18.     @Override
  19.     protected void onCreate(Bundle savedInstanceState) {
  20.         super.onCreate(savedInstanceState);
  21.         setContentView(R.layout.activity_register);
  22.         TextView RegisterHead=(TextView)findViewById(R.id.RegisterHeadline);
  23.         RegisterHead.setTextSize(25);
  24.         Button CompleteRegister=(Button)findViewById(R.id.CompleteRegisterBtn);
  25.         final EditText RegisteredUser=(EditText)findViewById(R.id.RegisteredUser);
  26.         final EditText RegisteredPass=(EditText)findViewById(R.id.RegisteredPass);
  27.         final EditText RegisteredName=(EditText)findViewById(R.id.RegisteredFn);
  28.         final EditText RegisteredPhone=(EditText)findViewById(R.id.RegisteredPhone);
  29.         final EditText RegisteredID=(EditText)findViewById(R.id.RegisteredID);
  30.         final String User2String=String.valueOf(RegisteredUser.getText());
  31.         final String Pass2String=String.valueOf(RegisteredPass.getText());
  32.         final String Name2String=String.valueOf(RegisteredName.getText());
  33.         final String Phone2String=String.valueOf(RegisteredPhone.getText());
  34.         final String ID2String=String.valueOf(RegisteredID.getText());
  35.         db=new MyDBHandler(this);
  36.         CompleteRegister.setOnClickListener(new View.OnClickListener() {
  37.             @Override
  38.             public void onClick(View v) {
  39.                 if(User2String.equals("")||Pass2String.equals("")|| Name2String.equals("")||Phone2String.equals("")||ID2String.equals("")){
  40.                     Toast.makeText(RegisterActivity.this, "", Toast.LENGTH_SHORT).show();
  41.                 }
  42.                 else {
  43.                     UserTable NewUser=new UserTable(User2String,Pass2String,Name2String,Phone2String,ID2String);
  44.                     db.Add(NewUser);
  45.                     Toast.makeText(RegisterActivity.this, "", Toast.LENGTH_SHORT).show();
  46.                     startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
  47.                 }
  48.             }
  49.         });
  50.     }
  51. }
RAW Paste Data
Top