The method findViewById
returns an instance of the class that is actually used to define that view in your XML file.
(Seekbar) is used to cast that view with specific view.
You have to cast that(findViewById
) to the class that your variable is defined when you use it.
So, This is the reason for
SeekBar timerSeekBar = (SeekBar)findViewById(R.id.timerSeekBar);
From API 26, findViewById uses inference for its return type, so you no longer have to cast.
Please check below reference link :
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/widget/SeekBar.java
ProgressBar is super class, AbsSeekbar is Child class of Progressbar and SeekBar is childclass of AbsSeekbar.
setMax() is method of Seekbar and setProgress() is method of Progressbar.
21
solved What is timerSeekBar in this java code an object or variable?What is findViewById,