SHARE
TWEET

Untitled

a guest Apr 19th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.myapplication;
  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. public class MainActivity extends AppCompatActivity {
  13.  
  14.     EditText Edit1;
  15.     EditText Edit2;
  16.     Button Btn1;
  17.  
  18.     @Override
  19.     protected void onCreate(Bundle savedInstanceState) {
  20.         super.onCreate(savedInstanceState);
  21.         setContentView(R.layout.activity_main);
  22.  
  23.         Edit1 = (EditText)findViewById(R.id.editText3);
  24.         Edit2 = (EditText)findViewById(R.id.editText4);
  25.         Btn1 = (Button)findViewById(R.id.button);
  26.  
  27.         Btn1.setOnClickListener(new View.OnClickListener() {
  28.             @Override
  29.             public void onClick(View v) {
  30.                 if (Edit1.getText().toString().equals("toto") && (Edit2.getText().toString().equals("titi"))){
  31.                     Intent i = new Intent(MainActivity.this,Main2Activity.class);
  32.                     startActivity(i);
  33.                 }
  34.                 else {
  35.                     Toast.makeText(MainActivity.this, "Wrong Password", Toast.LENGTH_LONG).show();
  36.                 }
  37.             }
  38.         });
  39.  
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top