-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeActivity.java
107 lines (98 loc) · 4.15 KB
/
HomeActivity.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.application.brainfit;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
public class HomeActivity extends AppCompatActivity {
ImageButton ib1, ib2, ib3;
TextView logout;
ImageButton call;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ib1 = (ImageButton) findViewById(R.id.ib1);
logout = (TextView) findViewById(R.id.logout);
ib2 = (ImageButton) findViewById(R.id.ib2);
ib3 = (ImageButton) findViewById(R.id.ib3);
call = (ImageButton) findViewById(R.id.call);
final TextView etage = (TextView) findViewById(R.id.age);
final EditText tv1 = (EditText) findViewById(R.id.tv1);
Intent i = getIntent();
String name = i.getStringExtra("name");
String age = i.getStringExtra("age");
//String msg = " Welcome to user area, "+name;
tv1.setText(name);
etage.setText(age);
logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(HomeActivity.this);
alertDialogBuilder
.setMessage("EXIT");
alertDialogBuilder
.setCancelable(false);
alertDialogBuilder
.setPositiveButton("Logout", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
}
});
alertDialogBuilder
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(getApplicationContext(),HomeActivity.class);
startActivity(intent);
finish();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
});
ib1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), FaceDetection.class);
startActivity(i);
}
});
ib2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), Exercise.class);
startActivity(i);
}
});
call.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String n = tv1.getText().toString();
Intent c = new Intent(Intent.ACTION_DIAL);
c.setData(Uri.parse("tel: " + n));
startActivity(c);
}
});
ib3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), AlarmMe.class);
startActivity(i);
}
});
}
}