I use a ProgressDialog
in the thread. In the onButtonClick
the thread is started, but when I touch anywhere on the screen the ProgressDialog
is closed.
How can I prevent this?
private void ButtonClick(View view) {
btn1 = (Button) view.findViewById(R.id.btn1);
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GetStudentData();
}
});
}
private synchronized void GetStudentData() {
try {
// Thread to display loader
new Thread() {
@Override
public void run() {
Looper.prepare();
dialog = Msg.ShowProgressDialogBox(
getActivity(),
dialog,
"Please wait while we fetch the student data...");
Looper.loop();
}
}.start();
new Thread() {
@Override
public void run() {
String studentData="Kailas";
}
}
} catch(Exception ex {
}
}
Update
When I touch on the screen the ProgressDialog
disappears but get all data.