android.app.ProgressDialog.dismiss()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中android.app.ProgressDialog.dismiss()方法的一些代码示例,展示了ProgressDialog.dismiss()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.dismiss()方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:dismiss

ProgressDialog.dismiss介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

ProgressDialog progress = new ProgressDialog(this);
progress.setTitle("Loading");
progress.setMessage("Wait while loading...");
progress.setCancelable(false); // disable dismiss by tapping outside of the dialog
progress.show();
// To dismiss the dialog
progress.dismiss();

代码示例来源:origin: stackoverflow.com

public class MyTask extends AsyncTask<Void, Void, Void> {
 public MyTask(ProgressDialog progress) {
  this.progress = progress;
 }

 public void onPreExecute() {
  progress.show();
 }

 public void doInBackground(Void... unused) {
  ... do your loading here ...
 }

 public void onPostExecute(Void unused) {
  progress.dismiss();
 }
}

代码示例来源:origin: stackoverflow.com

private ProgressDialog pdia;

@Override
protected void onPreExecute(){ 
  super.onPreExecute();
    pdia = new ProgressDialog(yourContext);
    pdia.setMessage("Loading...");
    pdia.show();    
}

@Override
protected void onPostExecute(String result){
  super.onPostExecute(result);
    pdia.dismiss();
}

代码示例来源:origin: stackoverflow.com

final Activity activity = this;

final ProgressDialog progressDialog = new ProgressDialog(activity);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);

browser.setWebChromeClient(new WebChromeClient() {
  public void onProgressChanged(WebView view, int progress) {
    progressDialog.show();
    progressDialog.setProgress(0);
    activity.setProgress(progress * 1000);

    progressDialog.incrementProgressBy(progress);

    if(progress == 100 && progressDialog.isShowing())
      progressDialog.dismiss();
  }
});

代码示例来源:origin: iMeiji/Toutiao

holder.tv_video_time.setText(tv_video_time);
final ProgressDialog dialog = new ProgressDialog(context);
dialog.setTitle(R.string.loading);
RxView.clicks(holder.itemView)
    .throttleFirst(1300, TimeUnit.MILLISECONDS)
    .doOnNext(o -> dialog.show())
    .observeOn(Schedulers.io())
    .switchMap((Function<Object, ObservableSource<String>>) o -> {
    })
    .subscribe(dataBean -> {
      dialog.dismiss();
      VideoContentActivity.launch(dataBean);
    }, throwable -> {
      dialog.dismiss();
      ErrorAction.print(throwable);
    });

代码示例来源:origin: stackoverflow.com

public class WebViewDemo extends Activity {
 private WebView webView;
 Activity activity ;
 private ProgressDialog progDailog; 
 @SuppressLint("NewApi")
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);
   activity = this;
   progDailog = ProgressDialog.show(activity, "Loading","Please wait...", true);
   progDailog.setCancelable(false);
   webView = (WebView) findViewById(R.id.webview_compontent);
   webView.getSettings().setJavaScriptEnabled(true);     
   webView.getSettings().setLoadWithOverviewMode(true);
   webView.getSettings().setUseWideViewPort(true);        
   webView.setWebViewClient(new WebViewClient(){
     @Override
     public boolean shouldOverrideUrlLoading(WebView view, String url) {
       progDailog.show();
       view.loadUrl(url);
       return true;                
     }
     @Override
     public void onPageFinished(WebView view, final String url) {
       progDailog.dismiss();
     }
   });
   webView.loadUrl("http://www.teluguoneradio.com/rssHostDescr.php?hostId=147");
   }

代码示例来源:origin: stackoverflow.com

if( (myProgressDialog!= null) && myProgressDialog.isShowing()){
  myProgressDialog.dismiss();
myProgressDialog.setCancelable(true);

代码示例来源:origin: stackoverflow.com

.queue();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(false);
mProgressDialog.show();
case Groundy.STATUS_FINISHED:
  Toast.makeText(DownloadExample.this, R.string.file_downloaded, Toast.LENGTH_LONG);
  mProgressDialog.dismiss();
  break;
case Groundy.STATUS_ERROR:
  Toast.makeText(DownloadExample.this, resultData.getString(Groundy.KEY_ERROR), Toast.LENGTH_LONG).show();
  mProgressDialog.dismiss();
  break;

代码示例来源:origin: stackoverflow.com

protected void onPreExecute()
  Dialog.setMessage("Doing something...");
  Dialog.show();
  Dialog.dismiss();

代码示例来源:origin: stackoverflow.com

ProgressDialog progressdialog = new ProgressDialog(getActivity());
progressdialog.show();
if(progressdialog.isShowing())
{
progressdialog.dismiss();
}

代码示例来源:origin: stackoverflow.com

public void onPageStarted(WebView view, String url, Bitmap favicon)
  pd.show();
   pd.dismiss();

代码示例来源:origin: ankidroid/Anki-Android

@SuppressWarnings("deprecation") // ProgressDialog change tracked in github as #5020
protected void translate() {
  if(!Connection.isOnline()) {
    showToast(gtxt(R.string.network_no_connection));
    return;
  }
  progressDialog = android.app.ProgressDialog.show(this, getText(R.string.multimedia_editor_progress_wait_title),
      getText(R.string.multimedia_editor_trans_translating_online), true, false);
  progressDialog.setCancelable(true);
  progressDialog.setOnCancelListener(this);
  mWebServiceAddress = computeAddress();
  try {
    mTranslationLoadPost = new BackgroundPost();
    mTranslationLoadPost.execute();
  } catch (Exception e) {
    progressDialog.dismiss();
    showToast(getText(R.string.multimedia_editor_something_wrong));
  }
}

代码示例来源:origin: stackoverflow.com

public void getMovies() {

   ProgressDialog mProgressDialog = new ProgressDialog(this);
   mProgressDialog.setIndeterminate(true);
   mProgressDialog.setMessage("Loading...");
   mProgressDialog.show();
   MovieClient.getWeather().movies(MovieClient.getRandomMovie(), new Callback<MovieRequest>() {
   @Override
   public void success(MovieRequest movieRequest, Response response) {

     Picasso.with(getApplicationContext()).load(movieRequest.getPoster()).into(image);

     if (mProgressDialog.isShowing())
      mProgressDialog.dismiss();

  }

   @Override
   public void failure(RetrofitError error) {
     if (mProgressDialog.isShowing())
      mProgressDialog.dismiss();

     Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();

   }
  });
}

代码示例来源:origin: stackoverflow.com

private class GetBookDataTask extends AsyncTask<String, Void, Void> {
  private ProgressDialog dialog = new ProgressDialog(BookScanResult.this);
  private String response;
  private HttpHelper httpHelper = new HttpHelper();
  // can use UI thread here
  protected void onPreExecute() {
    dialog.setMessage("Retrieving HTTP data..");
    dialog.show();
  }
  // automatically done on worker thread (separate from UI thread)
  protected Void doInBackground(String... urls) {
    response = httpHelper.performGet(urls[0]);
    // use the response here if need be, parse XML or JSON, etc
    return null;
  }
  // can use UI thread here
  protected void onPostExecute(Void unused) {
    dialog.dismiss();
    if (response != null) {
     // use the response back on the UI thread here
     outputTextView.setText(response);
    }
  }
 }

代码示例来源:origin: hiteshbpatel/Android_Blog_Projects

/**
 * 
 */
public void onInitiateDiscovery() {
  if (progressDialog != null && progressDialog.isShowing()) {
    progressDialog.dismiss();
  }
  progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel", "finding peers", true,
      true, new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
          
        }
      });
}

代码示例来源:origin: cSploit/android

mLoader = ProgressDialog.show(activity, "", getContext().getString(R.string.loading_changelog));
mLoader.dismiss();

代码示例来源:origin: stackoverflow.com

private class PrepareAdapter1 extends AsyncTask<Void,Void,ContactsListCursorAdapter > {
  ProgressDialog dialog;
  @Override
  protected void onPreExecute() {
    dialog = new ProgressDialog(viewContacts.this);
    dialog.setMessage(getString(R.string.please_wait_while_loading));
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);
    dialog.show();
  }
  /* (non-Javadoc)
   * @see android.os.AsyncTask#doInBackground(Params[])
   */
  @Override
  protected ContactsListCursorAdapter doInBackground(Void... params) {
    cur1 = objItem.getContacts();
    startManagingCursor(cur1);

    adapter1 = new ContactsListCursorAdapter (viewContacts.this,
        R.layout.contact_for_listitem, cur1, new String[] {}, new int[] {});

    return adapter1;
  }

  protected void onPostExecute(ContactsListCursorAdapter result) {
    list.setAdapter(result);
    dialog.dismiss();
  }
}

代码示例来源:origin: stackoverflow.com

mSpinner = new ProgressDialog(getContext());
mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
mSpinner.setMessage("Loading...");
  mSpinner.show();
  mSpinner.dismiss();

代码示例来源:origin: hiteshbpatel/Android_Blog_Projects

@Override
  public void onClick(View v) {
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
    config.wps.setup = WpsInfo.PBC;
    if (progressDialog != null && progressDialog.isShowing()) {
      progressDialog.dismiss();
    }
    progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
        "Connecting to :" + device.deviceAddress, true, true
        );
    ((DeviceActionListener) getActivity()).connect(config);
  }
});

代码示例来源:origin: cSploit/android

@Override
  public void run(){
    dialog.show();
    try{
      List<String> keys = keygen.getKeys();
      if(keys == null || keys.size() == 0){
        getActivity().runOnUiThread(new Runnable() {
          @Override
          public void run() {
            new ErrorDialog(getString(R.string.error), keygen.getErrorMessage().isEmpty() ? getString(R.string.wifi_error_keys) : keygen.getErrorMessage(), getActivity()).show();
          }
        });
      }
      else{
        mCurrentAp = ap;
        mKeyList = keys;
        nextConnectionAttempt();
      }
    }
    catch(Exception e){
      System.errorLogging(e);
    } finally{
      dialog.dismiss();
    }
  }
}).start();

相关文章