android中的进度对话框不会被忽略

时间:2018-01-11 05:37:46

标签: android

抱歉,如果我重复提问,

我在Handler类中使用以下代码: -

ProgressDialog progressDialog=new ProgressDialog(SensorDetailActivity.this);
progressDialog.show();
if (msg.what == Commands.COMMAND_READ.getIndex()) {
            byte[] readBuf = (byte[]) msg.obj;
            // construct a string from the valid bytes in the buffer
            String readMessage = new String(readBuf);
                final EditText currentSensorMeasurement = (EditText) findViewById(R.id.currentSensorMeaurmentEdit);
                currentSensorMeasurement.setText(readMessage.substring(readMessage.indexOf(" ") + 1,readMessage.indexOf(';')));
                if (currentSensorMeasurement.getText().toString().indexOf(';') > -1) {
                    currentSensorMeasurement.setText(currentSensorMeasurement.getText().toString().replace(';', ' ').trim());
                    progressDialog.dismiss();
                 }

我正在显示进度对话框,在完成操作后,我正在关闭进度对话框。但它没有被忽略。

1 个答案:

答案 0 :(得分:0)

您确定您的情况符合要求解除进度对话框吗?因为我没有看到其他部分。根据您的代码,如果您的情况不符合,那么在这种情况下,您的进度对话框不会被忽略。

if (currentSensorMeasurement.getText().toString().indexOf(';') > -1) {
                    currentSensorMeasurement.setText(currentSensorMeasurement.getText().toString().replace(';', ' ').trim());
                    progressDialog.dismiss();
                 }