Skip to content

Instantly share code, notes, and snippets.

@fatorx
Created June 15, 2015 12:30
Show Gist options
  • Save fatorx/a4a8d6ae285eec7cf1de to your computer and use it in GitHub Desktop.
Save fatorx/a4a8d6ae285eec7cf1de to your computer and use it in GitHub Desktop.
Meu primeiro contato com threads
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