¾È±Ô °øºÎ¹æ

Android > Webview - progressDialog ¶ç¿ì±â (·ÎµùÁß ¶ç¿ì±â)

µî·ÏÀÏ : 2017-07-06 17:46 Á¶È¸¼ö : 52,984

¸ÕÀú WebViewÀÇ ¸¸µå´Â ¹æ¹ýÀ» ¾Ë¾Æ ºÃ´Ù.

¿¬°áÁßÀÔ´Ï´Ù. ¸Þ¼¼Áö¸¦ ¶ç¿îÈÄ À¥ÆäÀÌÁö¸¦ ¿Ï·á Çϸé, ProgressDialog âÀ» ¾ø¾Ö´Â ¹æ¹ý ÀÔ´Ï´Ù.

InforWebViewClient Ŭ·¹½º¿¡¼­ ó¸®ÇØ¾ß ÇÒ ¿¹Á¦ ÀÔ´Ï´Ù.
 
ProgressDialog mProgress; public class InfoWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { mProgress = new ProgressDialog(activity); mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER); mProgress.setMessage("¿¬°áÁßÀÔ´Ï´Ù...."); mProgress.setCancelable(false); mProgress.show(); view.loadUrl(url); if (mProgress.isShowing()) { mProgress.dismiss(); } return true; } // À¥ÆäÀÌÁö ·ÎµùÀÌ ½ÃÀÛÇÒ ¶§ ó¸® @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { if (mProgress == null) { mProgress = new ProgressDialog(activity); mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER); //mProgress.setTitle("Loading..."); mProgress.setMessage("¿¬°áÁßÀÔ´Ï´Ù...."); mProgress.setCancelable(false); mProgress.show(); } } //À¥ÆäÀÌÁö ·ÎµùÁß ¿¡·¯°¡ ¹ß»ýÇßÀ»¶§ ó¸® @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { if (mProgress.isShowing()) { mProgress.dismiss(); } } //À¥ÆäÀÌÁö ·ÎµùÀÌ ³¡³µÀ» ¶§ ó¸® @Override public void onPageFinished(WebView view, String url) { if (mProgress.isShowing()) { mProgress.dismiss(); } } }
	ProgressDialog mProgress;


    public class InfoWebViewClient extends WebViewClient 
    {
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) 
		{
			mProgress = new ProgressDialog(activity);
			mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
			mProgress.setMessage("¿¬°áÁßÀÔ´Ï´Ù....");
			mProgress.setCancelable(false);
			
			mProgress.show();
			view.loadUrl(url);
					
			if (mProgress.isShowing()) {
				mProgress.dismiss();
			}

			return true;
		}
		
		// À¥ÆäÀÌÁö ·ÎµùÀÌ ½ÃÀÛÇÒ ¶§ ó¸®
		@Override
		public void onPageStarted(WebView view, String url, Bitmap favicon) {
			if (mProgress == null) {
				mProgress = new ProgressDialog(activity);
				mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
				//mProgress.setTitle("Loading...");
				mProgress.setMessage("¿¬°áÁßÀÔ´Ï´Ù....");
				mProgress.setCancelable(false);
				mProgress.show();
			}
		}
		  
		//À¥ÆäÀÌÁö ·ÎµùÁß ¿¡·¯°¡ ¹ß»ýÇßÀ»¶§ ó¸®
		@Override
		public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
			if (mProgress.isShowing()) {
				mProgress.dismiss();
			}
		}
		  
		//À¥ÆäÀÌÁö ·ÎµùÀÌ ³¡³µÀ» ¶§ ó¸®
		@Override
		public void onPageFinished(WebView view, String url) {
			if (mProgress.isShowing()) {
			mProgress.dismiss();
			}
		}
    }
	
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.