Skip to content

Instantly share code, notes, and snippets.

@AliAsadi
Last active February 16, 2021 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AliAsadi/41365a323c46b0c3ff9887ed197e6d90 to your computer and use it in GitHub Desktop.
Save AliAsadi/41365a323c46b0c3ff9887ed197e6d90 to your computer and use it in GitHub Desktop.
public class ThreadActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
//....
new DownloadTask(this).start();
}
private class DownloadTask extends Thread {
private final ThreadActivity threadActivity;
public DownloadTask(ThreadActivity threadActivity) {
this.threadActivity = threadActivity;
}
@Override
public void run() {
SystemClock.sleep(2000 * 10);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment