File tree Expand file tree Collapse file tree
app/src/main/java/de/interaapps/localweather Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,20 +73,6 @@ private void initialize() {
7373 weatherWindDeg = findViewById (R .id .weather_wind_deg );
7474 weatherSunrise = findViewById (R .id .weather_sunrise );
7575 weatherSunset = findViewById (R .id .weather_sunset );
76- }
77-
78- private void initializeLogic () {
79- Timer timer = new Timer ();
80- TimerTask tenMinTask = new TimerTask () {
81- @ Override
82- public void run () {
83- updateLocalWeather ();
84- }
85- };
86- timer .schedule (tenMinTask , 0 , 1000 *60 *10 ); //1000*60 = 1min *10 = 10min
87- }
88-
89- private void updateLocalWeather () {
9076 localWeather = new LocalWeather (this ,
9177 "OpenWeatherApiKey" ,
9278 true ,
@@ -114,8 +100,18 @@ public void onWeatherSuccess() {
114100 updateWeatherDetails ();
115101 }
116102 });
103+ }
117104
118- localWeather .fetchLocation ();
105+ private void initializeLogic () {
106+ Timer timer = new Timer ();
107+ TimerTask tenMinTask = new TimerTask () {
108+ @ Override
109+ public void run () {
110+ weatherReady = false ;
111+ localWeather .fetchLocation ();
112+ }
113+ };
114+ timer .schedule (tenMinTask , 0 , 1000 *60 *10 ); //1000*60 = 1min *10 = 10min
119115 }
120116
121117 private void updateWeatherDetails () {
You can’t perform that action at this time.
0 commit comments