How to use thread in Android?

This article teaches how to use thread class in Android.

There are two ways to use thread class.
One is directly used in the function.
The Runnable class is the job to do.

new Thread(new Runnable() { @Override public void run() { //Do things. } }).start();

Another is create a new class and extend the thread interface.

public class MyThread extends Thread { public void run() { //Do things. } }

No comments:

Post a Comment