Last active
November 2, 2020 09:38
-
-
Save Dcosta2205/d24595bbabbc51cd2d82cd048fa0fd4a to your computer and use it in GitHub Desktop.
This file contains 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
public class MainActivity extends AppCompatActivity { | |
private Runnable runnable = new Runnable() { | |
@Override | |
public void run() { | |
// This runs in background thread. Do heavy operations here | |
} | |
// This thread will die once it comes out of the run method | |
}; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Thread thread = new Thread(runnable); | |
thread.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment