Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.22 KB | None | 0 0
  1. package com.example.myapplication;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4. import android.content.Intent;
  5.  
  6. import android.os.Bundle;
  7.  
  8. import android.view.View;
  9. import android.widget.Button;
  10. import android.widget.EditText;
  11. import android.widget.TextView;
  12. import android.widget.Toast;
  13.  
  14.  
  15. public class MainActivity extends AppCompatActivity {
  16.     private EditText username;
  17.     private EditText password;
  18.     private Button login;
  19.     private TextView loginLocked;
  20.     private TextView attempts;
  21.     private TextView numberOfAttempts;
  22.     private Button recorder;
  23.     private TextView link;
  24.  
  25.  
  26.     @Override
  27.     protected void onCreate(Bundle savedInstanceState) {
  28.         super.onCreate(savedInstanceState);
  29.         setContentView(R.layout.activity_main);
  30.  
  31.         username = (EditText) findViewById(R.id.edit_user);
  32.         password = (EditText) findViewById(R.id.edit_password);
  33.         link=(Button) findViewById(R.id.button_link);
  34.         recorder=(Button) findViewById(R.id.button_recorder);
  35.         login = (Button) findViewById(R.id.button_login);
  36.         loginLocked = (TextView) findViewById(R.id.login_locked);
  37.         attempts = (TextView) findViewById(R.id.attempts);
  38.         numberOfAttempts = (TextView) findViewById(R.id.number_of_attempts);
  39.  
  40.  
  41.     }
  42.  
  43.  
  44.     public void Login(View view) {
  45.  
  46.  
  47.         if (username.getText().toString().equals("admin") &&
  48.                 password.getText().toString().equals("123")) {
  49.             Toast.makeText(getApplicationContext(), "ВЫ ВОШЛИ",Toast.LENGTH_SHORT).show();
  50.  
  51.  
  52.             Intent intent = new Intent(MainActivity.this,Second.class);
  53.             startActivity(intent);
  54.         }
  55.  
  56.  
  57.         else {
  58.             Toast.makeText(getApplicationContext(), "Неверные данные",Toast.LENGTH_SHORT).show();
  59.  
  60.  
  61.  
  62.             attempts.setVisibility(View.VISIBLE);
  63.             numberOfAttempts.setVisibility(View.VISIBLE);
  64.  
  65.         }
  66.     }
  67.  
  68.  
  69.     public void  recorder(View view) {
  70.         Intent intent = new Intent(MainActivity.this, Registering.class);
  71.         startActivity(intent);
  72.     }
  73.  
  74.     public void  link(View view) {
  75.         Intent intent = new Intent(MainActivity.this, Link.class);
  76.         startActivity(intent);
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement