-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainActivity.java
75 lines (44 loc) · 1.56 KB
/
MainActivity.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
package com.techhelpbd.digitaltasbih;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
TextView tvCount,mahbubDev;
Button buttonAdd, buttonSub, buttonReset;
int count=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvCount = findViewById(R.id.tvCount);
mahbubDev = findViewById(R.id.mahbubDev);
buttonAdd = findViewById(R.id.buttonAdd);
buttonSub = findViewById(R.id.buttonSub);
buttonReset = findViewById(R.id.buttonReset);
//============================================================================
//on click event here
buttonAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
count++;
tvCount.setText(""+count);
}
});
buttonSub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
count--;
tvCount.setText(""+count);
}
});
buttonReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
count = 0;
tvCount.setText(""+count);
}
});
}
}