Thursday, December 5, 2013

What to do to stop a thread in Android?

Options:

1)
if(threadOne != null) {
Thread temp = threadOne;
threadOne = null;
temp.interrupt();
}

2)
Declare threads as Daemon threads.

threadOne.setDaemon(true);
threadOne.start();

No comments:

Post a Comment