Answer the question
In order to leave comments, you need to log in
How to make a dynamic change of photo and text by time of day?
How to make a dynamic change of picture and text, depending on the time of day on the fragment?
Simply put, if the time is from 6 am to 12 am, then one text and one picture are shown, by one o'clock in the afternoon, this picture and text change.
I do everything on Android Stuio.
Answer the question
In order to leave comments, you need to log in
var currentHour = Instant.now().get(CLOCK_HOUR_OF_DAY);
if (currentHour <= 12 && currentHour >= 6) {
// показывается один текст и одна картинка
} else {
// эта картинка и текст изменяются.
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question