Last active
December 17, 2015 03:18
-
-
Save flaviocdc/5541824 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Handler handler; | |
| @Backgroud public void atualizarEstadoCasa() { | |
| // ir no servidor | |
| // para atualizar a tela vc tem que fazer na thread a UI | |
| atualizarTelaComEstadoDaCasa(); | |
| // agendar uma nova atualizacao | |
| handler.postDelayed(20000, new Runnable() { | |
| public void run() { atualizarEstadoCasa() | |
| }); | |
| } | |
| @UiThread | |
| public void atualizarTelaComEstadoDaCasa() | |
| { | |
| // atualizar a tela | |
| } | |
| public void onCreate(...) { | |
| handler = new Handler(); | |
| handler.postDelayed(20000, new Runnable() { | |
| public void run() { atualizarEstadoCasa() | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment