-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
31 lines (26 loc) · 973 Bytes
/
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
package com.jetec.numberpickerandinterface_demo;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**開啟模組*/
TimePickerDialog dialog = new TimePickerDialog(this);
Button btShow = findViewById(R.id.button);
TextView tvRes = findViewById(R.id.textView_Respond);
btShow.setOnClickListener(v -> {
dialog.showDialog();
});
/**這邊取得自己所設置之模組回調*/
dialog.onDialogRespond = new TimePickerDialog.OnDialogRespond() {
@Override
public void onRespond(String selected) {
tvRes.setText(selected);
}
};
}
}