import
android.app.ProgressDialog;
import android.os.Bundle;
import
android.view.KeyEvent;
import
android.webkit.WebView;
import
android.webkit.WebViewClient;
import com.unity.util.Constant;
public class Activity_webview extends Activity
{
private WebView webview;
ProgressDialog
dialog;
@Override
protected void onCreate(Bundle
savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
webview = (WebView)
findViewById(R.id.webview);
dialog = new
ProgressDialog(Activity_webview.this);
dialog.setMessage("Loading......");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
dialog.show();
webview.getSettings().setJavaScriptEnabled(true);
//Below is propery for set web page fit to screen
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true); webview.getSettings().setBuiltInZoomControls(true);
//Below is propery for set web page fit to screen
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true); webview.getSettings().setBuiltInZoomControls(true);
webview.setWebViewClient(new WebviewUrl());
webview.loadUrl(Constant.FACEBOOK_URL);
}
public class WebviewUrl extends WebViewClient
{
@Override
public boolean
shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
@Override
public void
onPageFinished(WebView view, String url)
{
// TODO Auto-generated
method stub
super.onPageFinished(view,
url);
if (dialog.isShowing())
{
dialog.dismiss();
}
}
}
More Ref link:
I
will be happy if you will provide your feedback or follow this blog. Any suggestion
and help will be appreciated.
Thank
you :)
No comments:
Post a Comment