-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginActivity.java
72 lines (50 loc) · 2.11 KB
/
LoginActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.example.vasu_pc.trails;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* A login screen that offers login via email/password.
*/
public class LoginActivity extends Activity {
Button b1;
EditText ed1, ed2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
final Intent intent = new Intent(this, MainActivity.class);
b1 = (Button) findViewById(R.id.button5);
//final String ed1s,ed2s;
ed1 = (EditText) findViewById(R.id.editText);
ed2 = (EditText) findViewById(R.id.editText2);
// ed1s=ed1.getText().toString();
//ed2s=ed2.getText().toString();
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ((ed1.getText().toString().equals("admin") &&ed2.getText().toString().equals("admin"))||(ed1.getText().toString().equals("sujata")&&ed2.getText().toString().equals("sujata"))||((ed1.getText().toString().equals("maitri")&&ed2.getText().toString().equals("maitri"))))
{
Toast.makeText(getApplicationContext(), "Logging In...", Toast.LENGTH_SHORT).show();
// String message = ed1.getText().toString();
// intent.putExtra("Welcome", message);
startActivity(intent);
}
else {
Toast.makeText(getApplicationContext(), "Invalid User", Toast.LENGTH_SHORT).show();
startActivity(intent);
}
}
});
}
}
/**
* A dummy authentication store containing known user names and passwords.
* TODO: remove after connecting to a real authentication system.
*/
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/