boolean mFlag = true;
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
while(mFlag) {
...
//Working
...
}
}
});
thread.start();
Than set mFlag to false somewhere.
如果在Android中,Thread沒辦法停掉,則會造成一個Memory Leak
沒有留言:
張貼留言