发送短信时关闭Dialogprogress

时间:2014-11-04 03:07:46

标签: android progressdialog

请帮助,我想要更新消息并在smsmanager发送特定活动时关闭我的dialogprogress

 @Override
  protected Void doInBackground(Void... values) {
     try {
        for (int i = 1; i <= 10; i++) {
            publishProgress(i * 10);
            if (ACTIVITY) { // set spesific activity
                if (METHOD SEND SUCCESS) {
                    stateProgressDialog = 1; // CREATE STATUS TO onPOSTEXECUDE for update MESSAGE
                    publishProgress(0);
                    Thread.sleep(0);
                    Thread.interrupted();
                }
            }
            Thread.sleep(5000);
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

1 个答案:

答案 0 :(得分:0)

您必须在YOURPROGRESS方法中编写代码以隐藏YOURPROGRESS。只需覆盖 onPostExecute()方法,然后在 AsyncTask 中编写此代码。

@override
protected void onPostExecute(){
       YOURPROGRESS.setVisibility(View.GONE);
       YOURPROGRESS=null;
       //or do whatever you want

}