I want to stop my thread if record were fetched please help me out. Here is my code.
if (dialog==null) {
dialog = ProgressDialog.show(AgentProgress.this, "",
"Fetching Records...", true);
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(5000);
loadnames load1 = new loadnames();
load1.execute("");
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); //this is a MUST
}
}
}).start();
}
In this loadnames are class that fetches name if it fetches then thread would stop.