-
-
Save fatorx/a4a8d6ae285eec7cf1de to your computer and use it in GitHub Desktop.
Meu primeiro contato com threads
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
final Handler handler = new Handler(){ | |
@Override | |
public void handleMessage(Message msg) { | |
switch(msg.what){ | |
case 0: | |
nextActivity(); | |
progress.dismiss(); | |
} | |
super.handleMessage(msg); | |
} | |
}; | |
Thread threadExecute = new Thread(){ | |
public void run(){ | |
try { | |
executePost(); | |
Thread.sleep(1000); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); | |
} | |
handler.sendEmptyMessage(0); | |
} | |
}; | |
threadExecute.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment