-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
66 lines (53 loc) · 2.06 KB
/
MainActivity.java
File metadata and controls
66 lines (53 loc) · 2.06 KB
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
package com.example.covid_19;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
EditText t1, t2, t3;
Button b1;
CheckBox c1, c2, c3, c4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
t1 = findViewById(R.id.name);
t2 = findViewById(R.id.place);
t3 = findViewById(R.id.aadhar);
b1 = findViewById(R.id.button);
c1 = findViewById(R.id.checkBox);
c2 = findViewById(R.id.checkBox2);
c3 = findViewById(R.id.checkBox3);
c4 = findViewById(R.id.checkBox4);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
String str = t1.getText().toString();
String str1 = t2.getText().toString();
int a = Integer.parseInt(t3.getText().toString());
if(c1.isChecked()){
if(c2.isChecked()){
if(c3.isChecked()){
if(c4.isChecked()){
Toast.makeText(getApplicationContext(),"COVID-19 Positive",Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(),"Please select checkboxes to check",Toast.LENGTH_LONG).show();
}
}
}
}
Intent i = new Intent(MainActivity.this, Main3Activity.class);
i.putExtra("Name",str);
i.putExtra("Place", str1);
i.putExtra("Number", a);
startActivity(i);
}
});
}
}