Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.yashu.helpinghands;
- import android.content.Intent;
- import android.graphics.Paint;
- 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 android.widget.Toast;
- public class LoginActivity extends AppCompatActivity {
- private static EditText username;
- private static EditText password;
- private static Button login_button;
- private static TextView link_signup;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- LoginButton();
- }
- public void LoginButton(){
- username = (EditText)findViewById(R.id.input_name);
- password = (EditText)findViewById(R.id.input_password);
- login_button = (Button)findViewById(R.id.btn_login);
- link_signup = (TextView)findViewById(R.id.link_signup);
- //Underlined the text of "Dont have an account? Create one" from here
- link_signup.setPaintFlags(link_signup.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
- login_button.setOnClickListener(
- new View.OnClickListener()
- {
- @Override
- public void onClick(View v) {
- if (username.getText().toString().equals("user") || password.getText().toString().equals("pass"))
- {
- Toast.makeText(LoginActivity.this, "Username and password is correct",
- Toast.LENGTH_SHORT).show();
- Intent intent = new Intent(getBaseContext(), MapsActivity.class);
- startActivity(intent);
- }
- else
- {
- Toast.makeText(LoginActivity.this, "Username and password is NOT correct",
- Toast.LENGTH_SHORT).show();
- }
- }
- });
- link_signup.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // Start the Signup activity
- Intent intent = new Intent(getBaseContext(), RegisterActivity.class);
- startActivity(intent);
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment