Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.lenovo.myapplication;
- import android.app.AlertDialog;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- import com.example.lenovo.myapplication.proses.proses_crud;
- public class MainActivity extends AppCompatActivity {
- EditText username, password, ulangpass;
- Button btn_daftar;
- TextView login;
- AlertDialog.Builder builder;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- username = (EditText) findViewById(R.id.username);
- password = (EditText) findViewById(R.id.password);
- ulangpass = (EditText) findViewById(R.id.password_konf);
- btn_daftar = (Button) findViewById(R.id.button);
- btn_daftar.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (username.getText().toString().equals("")||password.getText().toString().equals("")){
- builder = new AlertDialog.Builder(FormRegister.this);
- builder.setTitle("Informasi");
- builder.setMessage("Your fill not input..!!");
- builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- dialogInterface.dismiss();
- }
- });
- AlertDialog alertDialog = builder.create();
- alertDialog.show();
- }else if (!password.getText().toString().equals(ulangpass.getText().toString())){
- builder = new AlertDialog.Builder(FormRegister.this);
- builder.setTitle("Informsi");
- builder.setMessage("Maaf password dan ulangi password tidak sama...!");
- builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- dialogInterface.dismiss();
- }
- });
- AlertDialog alertDialog = builder.create();
- alertDialog.show();
- }
- else {
- proses_crud backgroundTask = new proses_crud(FormRegister.this);
- backgroundTask.execute("Daftar", username.getText().toString(),password.getText().toString());
- }
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment