Is there a slicker/simpler way of doing the following? I have a method in a class that shows a progressbar while a thread runs. This code works but it just seems a little overly clunky having 3 steps.
private void pause() {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mProgressBar.setVisibility(View.VISIBLE);
}
});
new Thread(new Runnable() {
@Override
public void run() {
try {
//do stuff
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mProgressBar.setVisibility(View.GONE);
}
});
}