Android Java: "cannot Resolve" In Postdelayed
I am using the first answer here to try to initiate a repeating task, updating a seekbar ('timeSlider') to show progress as an audio file plays. The repeating function is updateTi
Solution 1:
You could replace:
timeSliderHandler.postDelayed(updateTimeSlider, timeSliderInterval);
with:
timeSliderHandler.postDelayed(doUpdateTimeSlider, timeSliderInterval);
You forgot to write do
in doUpdateTimeSlider
.
Solution 2:
As you can see here : https://stackoverflow.com/a/41413191/4409113
It is : doUpdateTimeSlider
finalRunnabledoUpdateTimeSlider=newRunnable() {
@Overridepublicvoidrun() {
timeSliderHandler.postDelayed(doUpdateTimeSlider, timeSliderInterval);
updateTimeSlider();
}
};
Which @ρяσѕρєя K said the same.
Update:
To fix that may not have been initialized
you can follow these links:
variable r might not have been initialized
"Variable example might not have been initialized" in anonymous class
So:
finalRunnableetc=null;
finalRunnabledoUpdateTimeSlider=newRunnable() {
@Overridepublicvoidrun() {
timeSliderHandler.postDelayed(etc, timeSliderInterval);
updateTimeSlider();
}
};
This should work now!
Post a Comment for "Android Java: "cannot Resolve" In Postdelayed"