-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
38 lines (28 loc) · 973 Bytes
/
MainActivity.java
File metadata and controls
38 lines (28 loc) · 973 Bytes
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
package com.example.balapan;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Button;
import java.util.Timer;
import java.util.TimerTask;
public class MainActivity extends AppCompatActivity {
private PlayView playView;
private Handler handler=new Handler();
private final static long TIMER_INTERVAL=30;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
playView=new PlayView(this);
setContentView(playView);
Button pauseBtn;
pauseBtn = (Button)findViewById(R.id.pauseBtn);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
playView.invalidate();
}
},0,TIMER_INTERVAL);
}
}