Advertisement
TheNameOfRose

startactivity

Feb 20th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. package com.example.lapitmessenger;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9.  
  10. public class StartActivity extends AppCompatActivity {
  11.  
  12.     private Button mRegButton;
  13.     private Button mLogButton;
  14.  
  15.     @Override
  16.     protected void onCreate(Bundle savedInstanceState) {
  17.         super.onCreate(savedInstanceState);
  18.         setContentView(R.layout.activity_start);
  19.  
  20.         mRegButton = findViewById(R.id.start_reg_button);
  21.         mLogButton = findViewById(R.id.log_in_button);
  22.  
  23.         mRegButton.setOnClickListener(new View.OnClickListener() {
  24.             @Override
  25.             public void onClick(View view) {
  26.                 Intent regIntent = new Intent(StartActivity.this, RegisterActivity.class);
  27.                 startActivity(regIntent);
  28.  
  29.             }
  30.         });
  31.  
  32.         mLogButton.setOnClickListener(new View.OnClickListener() {
  33.             @Override
  34.             public void onClick(View view) {
  35.                 Intent intent = new Intent(StartActivity.this, LoginActivity.class);
  36.                 startActivity(intent);
  37.                 finish();
  38.             }
  39.         });
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement