Reputation: 670
I am currently working on an android music app which needs to call an api to get the link of album-art and put it in slider, after 'x' seconds I have to call another api and get an url of advertisement and load it on slider. And then after 'y' seconds I have to repeat the whole process.
What is the best way to implement it without having memory leakage issue. I am currently using 'https://github.com/daimajia/AndroidImageSlider' this slider.
To be more specific, let's say I have two functions, I need to call both periodically after '12' and '3' seconds, how can I implement it.
Upvotes: 2
Views: 77
Reputation: 110
you can achieve this by using postDelayed()
final Handler h = new Handler();
h.postDelayed (() -> {
//your code here
}, DELAY_TIME);
Upvotes: 2