Tuesday, 15 February 2011

java - How to stop thread while button is clicked in android -



java - How to stop thread while button is clicked in android -

in application thread running while user click button want stop thread execution .can tell how do.i tried in way in on click

if(v.getid()==r.id.btnyeartodate) { thr.stop(); }

but getting run time error

thanks

public class task implements runnable { private volatile boolean isrunning = true; public void run() { while (isrunning) { //do work } } public void kill() { isrunning = false; } } task.kill();

see

java android

No comments:

Post a Comment