SHARE
TWEET

Untitled

a guest Oct 21st, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.myapplication;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  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 implements View.OnClickListener {
  13.  
  14.     EditText editName;
  15.     EditText editPass;
  16.     Button btnLogin;
  17.     TextView txtReg;
  18.  
  19.     @Override
  20.     protected void onCreate(Bundle savedInstanceState) {
  21.         super.onCreate(savedInstanceState);
  22.         setContentView(R.layout.activity_main);
  23.         InitControl();
  24.     }
  25.  
  26.     private void InitControl() {
  27.         editName=findViewById(R.id.editName);
  28.         editPass=findViewById(R.id.editPass);
  29.         btnLogin=findViewById(R.id.btnLogin);
  30.         txtReg=findViewById(R.id.txtReg);
  31.     }
  32.  
  33.     @Override
  34.     public void onClick(View v) {
  35.         switch (v.getId()) {
  36.             case R.id.btnLogin:
  37.                 Toast.makeText(this, "Login", Toast.LENGTH_SHORT).show();
  38.                 return;
  39.             case R.id.txtReg:
  40.                 Toast.makeText(this, "Reg", Toast.LENGTH_SHORT).show();
  41.                 return;
  42.         }
  43.     }
  44. }
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
 
Top