2014-11-04 64 views
0

請幫幫忙,我想更新消息,並關閉我的dialogprogress時smsmanager是派人spesific活動關閉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; 
} 

回答

0

你必須YOURPROGRESS方法隱藏YOURPROGRESS編寫代碼。只需覆蓋onPostExecute()方法並將其寫入AsyncTask

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

} 
+0

對於隱藏對話框,如何更新dialogprogress上的消息? – Ashadi 2014-11-04 04:20:32

+0

@Ashadi你可以在你的doInbackground()方法中做。 – 2014-11-04 04:21:45

+0

謝謝@pratt我會試試 – Ashadi 2014-11-04 06:11:56