android - handler, I want to run periodically -


using handler wants run periodically count 0, if countis 1, else please fix code.

mrunnable = new runnable(){ @override public void run() { if(count == 0){ setimage(); count = 1; } else{ weather = mcontentresolver.gettype(muri); setweather(weather); count = 0; } }  }; mhandler = new handler(); mhandler.postdelayed(mrunnable, 3000); 

try below

m_handler = new handler(); mrunnable = new runnable(){     @override     public void run() {         if(count == 0){             //             count = 1;         }         else if (count==1){             //             count = 0;         }         m_handler.postdelayed(mrunnable, 3000);// move inside run method     }  }; mrunnable.run(); // missing 

also check this

android thread timer


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -