I am having a progress bar which keeps running until I am connected to BLE.Here is the code -
@Override
public void Progress() {
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (progressDialog == null) {
progressDialog = ProgressDialog.show(activity, getString(R.string.wait), getResources().getString(R.string.connecting), true, false);
}
progress.setVisibility(View.VISIBLE);
container.setVisibility(View.GONE);
}
});
}
When the progress is running I mean when the progress dialog is being shown, if Bluetooth in Settings is disabled, I need to detect it and stop the progress and close the dialog. How do I do this in run()
.