Hi experts,
I need some help as i am just calling a method in a thread. now what i want is wait for reply form getData() method only for 15 seconds. If it reply before 15 seconds it should be terminated otherwise after 15 seconds it should be terminated. The code is given below:
boolean networkStatus;
private Runnable runnable;
private ProgressDialog m_ProgressDialog = null;
private Runnable returnRes = new Runnable() {
@Override
public void run() {
if(networkStatus){
setData();
m_ProgressDialog.dismiss();
}
};
private void callGetdata(){
runnable = new Runnable() {
@Override
public void run() {
networkStatus = getData();
runOnUiThread(returnRes);
}
};
Thread thread = new Thread(null, runnable, "MovetoBackground");
thread.start();
m_ProgressDialog = ProgressDialog.show(this, "", getString(R.string.loadMsg), true);
}