2017-06-14 52 views
-7

我從服務器獲取圖像,並顯示在定製對話框它,我想顯示進度對話框,同時圖像的獲取。如何顯示進度定製對話的對話?

我用這

loadingDialog = ProgressDialog.show(getActivity(), "", "Loading. Please wait...", true); 

但定製對話框下隱藏。

回答

0

將這個代碼在添加下面的代碼之後,從服務器獲取的圖像

try { 
    progDialog = new ProgressDialog(Activity_FindInfo.this); 
    progDialog.setIndeterminate(true); 
    progDialog.setMessage("loading"); 
    progDialog.setCancelable(false); 
    progDialog.show(); 
} catch (Exception ex) { 
} 
+0

我正在使用這個loadingDialog = ProgressDialog.show(getActivity(),「」,「Loading。請稍候......「,真);?但它定製對話框下隱藏 – Preet

+0

ü創建一個自定義對話框視圖 –

0

聲明這在你的類

private ProgressDialog progDialog; 

呼叫只是調用之前你抓取圖像..

try { 
    progDialog = new ProgressDialog(yourCustomDialog.getContext()); 
    progDialog.setIndeterminate(true); 
    progDialog.setMessage("fetching image..."); 
    progDialog.setCancelable(false); 
    progDialog.show(); 
} catch (Exception ex) { 
} 

然後當圖像被提取之前添加此駁回對話框..

try { 
    if (progDialog != null && progDialog.isShowing()) { 
     progDialog.dismiss(); 
    } 
} catch (Exception ex) { 
} 
+0

這種方式添加yourCustomDialog.getContext()這條線progDialog =新ProgressDialog(yourCustomDialog.getContext()); –