Example usage for android.webkit WebSettings setBuiltInZoomControls

List of usage examples for android.webkit WebSettings setBuiltInZoomControls

Introduction

In this page you can find the example usage for android.webkit WebSettings setBuiltInZoomControls.

Prototype




public abstract void setBuiltInZoomControls(boolean enabled);

Source Link

Document

Sets whether the WebView should use its built-in zoom mechanisms.

Usage

From source file:com.air.mobilebrowser.BrowserActivity.java

/** 
 * Configure a webview to use the activity as
 * its client, and update its settings with 
 * the desired parameters for the activity.
 * @param webView the webview to configure.
 *//*from   w  w w . ja v a  2 s.c om*/
private void configureWebView(WebView webView) {
    webView.clearCache(true);
    webView.setWebViewClient(new SecureWebClient(this));

    WebSettings settings = mWebView.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);
    //      settings.setPluginState(PluginState.ON_DEMAND);
    settings.setPluginState(PluginState.ON);
    settings.setAllowFileAccess(true);
    settings.setAllowContentAccess(true);
    settings.setSaveFormData(false);
    settings.setSavePassword(false);
    webView.clearFormData();
    settings.setDomStorageEnabled(true);
    String defaultUserAgent = settings.getUserAgentString();

    StringBuilder sb = new StringBuilder();
    sb.append(defaultUserAgent);
    sb.append(" SmarterSecureBrowser/1.0");
    sb.append(" OS/");
    sb.append(mDeviceStatus.operatingSystem);
    sb.append(" Version/");
    sb.append(mDeviceStatus.operatingSystemVersion);
    sb.append(" Model/");
    sb.append(mDeviceStatus.model);

    settings.setUserAgentString(sb.toString());
}

From source file:com.owncloud.android.ui.dialog.LoginWebViewDialog.java

@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override//  w  w  w  .jav  a  2  s . c  om
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState);

    // Inflate layout of the dialog  
    RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.webview_dialog, container, false); // null parent view because it will go in the dialog layout

    if (mWebView == null) {
        // initialize the WebView
        mWebView = new SsoWebView(getActivity().getApplicationContext());
        mWebView.setFocusable(true);
        mWebView.setFocusableInTouchMode(true);
        mWebView.setClickable(true);

        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setSavePassword(false);
        webSettings.setUserAgentString(MainApp.getUserAgent());
        webSettings.setSaveFormData(false);
        // next two settings grant that non-responsive webs are zoomed out when loaded
        webSettings.setUseWideViewPort(true);
        webSettings.setLoadWithOverviewMode(true);
        // next three settings allow the user use pinch gesture to zoom in / out
        webSettings.setSupportZoom(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setDisplayZoomControls(false);
        webSettings.setAllowFileAccess(false);

        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptCookie(true);
        cookieManager.removeAllCookie();

        mWebView.loadUrl(mInitialUrl);
    }

    mWebViewClient.addTargetUrls(mTargetUrls);
    mWebView.setWebViewClient(mWebViewClient);

    // add the webview into the layout
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    ssoRootView.addView(mWebView, layoutParams);
    ssoRootView.requestLayout();

    return ssoRootView;
}

From source file:com.usabusi.newsreader.ArticleFragment.java

/**
 * Sets up the UI. It consists if a single WebView.
 */// w w w. ja v  a 2s  .c o  m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mWebView = new WebView(getActivity());
    //http://stackoverflow.com/questions/17259537/load-webview-from-cache
    WebSettings webSettings = mWebView.getSettings();
    // Enable JavaScript
    webSettings.setJavaScriptEnabled(true); // enable javascript
    mWebView.setHorizontalScrollBarEnabled(false);
    webSettings.setAppCacheMaxSize(5 * 1024 * 1024); // 5MB
    webSettings.setAppCachePath(getActivity().getApplicationContext().getCacheDir().getAbsolutePath());
    webSettings.setAllowFileAccess(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setCacheMode(WebSettings.LOAD_DEFAULT); // load online by default
    //http://stackoverflow.com/questions/25161720/url-opened-in-browser-instead-of-web-view
    mWebView.setVisibility(View.VISIBLE);
    webSettings.setPluginState(WebSettings.PluginState.ON);
    webSettings.setBuiltInZoomControls(true);

    //final Activity activity = this;
    // Make WebClient
    mWebView.setWebViewClient(new WebViewClient() {
        // Trace Errors
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(getActivity().getApplicationContext(), description, Toast.LENGTH_SHORT).show();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            //http://developer.android.com/guide/webapps/webview.html#HandlingNavigation
            //                view.loadUrl(url);
            //                return true;
            return false;
        }
    });

    loadWebView();
    return mWebView;
}

From source file:io.selendroid.server.model.SelendroidWebDriver.java

private void configureWebView(final WebView view) {
    ServerInstrumentation.getInstance().getCurrentActivity().runOnUiThread(new Runnable() {

        @Override//w ww.  j  a v a2 s. c  om
        public void run() {
            try {
                view.clearCache(true);
                view.clearFormData();
                view.clearHistory();
                view.setFocusable(true);
                view.setFocusableInTouchMode(true);
                view.setNetworkAvailable(true);
                // need to check the class name rather than checking instanceof
                // since when it is not an instanceof, it likely means the app under test
                // does not contain the Cordova project and this will cause a RuntimeException
                if (view.getClass().getSimpleName().equalsIgnoreCase("CordovaWebView")) {
                    CordovaWebView webview = (CordovaWebView) view;
                    CordovaInterface ci = null;
                    chromeClient = new ExtendedCordovaChromeClient(null, webview);
                } else {
                    chromeClient = new SelendroidWebChromeClient();
                }
                view.setWebChromeClient(chromeClient);

                WebSettings settings = view.getSettings();
                settings.setJavaScriptCanOpenWindowsAutomatically(true);
                settings.setSupportMultipleWindows(true);
                settings.setBuiltInZoomControls(true);
                settings.setJavaScriptEnabled(true);
                settings.setAppCacheEnabled(true);
                settings.setAppCacheMaxSize(10 * 1024 * 1024);
                settings.setAppCachePath("");
                settings.setDatabaseEnabled(true);
                settings.setDomStorageEnabled(true);
                settings.setGeolocationEnabled(true);
                settings.setSaveFormData(false);
                settings.setSavePassword(false);
                settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
                // Flash settings
                settings.setPluginState(WebSettings.PluginState.ON);

                // Geo location settings
                settings.setGeolocationEnabled(true);
                settings.setGeolocationDatabasePath("/data/data/selendroid");
            } catch (Exception e) {
                SelendroidLogger.error("Error configuring web view", e);
            }
        }
    });
}

From source file:com.pursuer.reader.easyrss.WebpageItemViewCtrl.java

@SuppressLint("SetJavaScriptEnabled")
public WebpageItemViewCtrl(final DataMgr dataMgr, final Context context, final String uid,
        final boolean isMobilized) {
    super(dataMgr, R.layout.webpage_item, context);

    this.item = dataMgr.getItemByUid(uid, ITEM_PROJECTION);
    this.theme = new SettingTheme(dataMgr).getData();
    this.fontSize = new SettingFontSize(dataMgr).getData();
    // Disable hardware acceleration on Android 3.0-4.1 devices.
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1
            && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }/* www  .  j a  va 2 s . c  o m*/

    {
        mobilizedView = (WebView) view.findViewById(R.id.MobilizedContent);
        mobilizedView.setBackgroundColor(context.getResources().getColor(
                theme == SettingTheme.THEME_NORMAL ? R.color.NormalBackground : R.color.DarkBackground));
        mobilizedView.setFocusable(false);
        final WebSettings settings = mobilizedView.getSettings();
        settings.setDefaultTextEncodingName(HTTP.UTF_8);
        settings.setJavaScriptEnabled(false);
        settings.setDefaultFontSize(fontSize);
    }
    {
        originalView = (WebView) view.findViewById(R.id.OriginalContent);
        originalView.setFocusable(false);
        originalView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        final WebSettings settings = originalView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        originalView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(final WebView webView, final String url) {
                view.findViewById(R.id.OriginalProgress).setVisibility(View.GONE);
            }

            @Override
            public void onPageStarted(final WebView webView, final String url, final Bitmap favicon) {
                if (!showMobilized) {
                    view.findViewById(R.id.OriginalProgress).setVisibility(View.VISIBLE);
                }
            }

            @Override
            public boolean shouldOverrideUrlLoading(final WebView webView, final String url) {
                webView.loadUrl(url);
                return false;
            }
        });
    }

    if (isMobilized) {
        showMobilizedPage();
    } else {
        showOriginalPage();
    }

    view.findViewById(R.id.BtnMobilzedPage).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            showMobilizedPage();
        }
    });
    view.findViewById(R.id.BtnOriginalPage).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            showOriginalPage();
        }
    });
    view.findViewById(R.id.BtnClose).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View view) {
            if (listener != null) {
                listener.onBackNeeded();
            }
        }
    });
}

From source file:com.tfc.webviewer.ui.WebViewerActivity.java

@SuppressLint("SetJavaScriptEnabled")
private void bindView() {
    // Toolbar//w w  w.ja  va 2 s.c  om
    mTvTitle = (TextView) findViewById(R.id.toolbar_tv_title);
    mTvUrl = (TextView) findViewById(R.id.toolbar_tv_url);

    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.a_web_viewer_coordinatorlayout);
    mProgressBar = (ProgressBar) findViewById(R.id.a_web_viewer_pb);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.a_web_viewer_srl);
    mWebView = (WebView) findViewById(R.id.a_web_viewer_wv);
    mSwipeRefreshLayout.setOnRefreshListener(this);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        webSettings.setDisplayZoomControls(false);
    }
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSupportZoom(true);
    webSettings.setDomStorageEnabled(true);

    mWebView.setWebChromeClient(new MyWebChromeClient());
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setDownloadListener(this);
    mWebView.setOnCreateContextMenuListener(this);

    mBtnMore = (AppCompatImageButton) findViewById(R.id.toolbar_btn_more);

    //noinspection ConstantConditions
    findViewById(R.id.toolbar_btn_close).setOnClickListener(this);
    //noinspection ConstantConditions
    mBtnMore.setOnClickListener(this);

    // PopupWindow
    initPopupMenu();
}

From source file:net.evecom.android.web.Web5Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/*w  w  w .j  a va  2 s.  c om*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web5Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // webView.loadUrl("http://www.baidu.com");
    // String url = HttpUtil.BASE_PC_URL
    // + "/buildingController/login"; http://harlan-pc/gssms/mobile/
    // String url =HttpUtil.BASE_PC_URL+"/loginController/countLogin";
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/countLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web4Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**//from  w ww  .j av  a 2  s .  co  m
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web4Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // webView.loadUrl("http://www.baidu.com");
    // String url = HttpUtil.BASE_PC_URL
    // + "/buildingController/login"; http://harlan-pc/gssms/mobile/
    // String url
    // =HttpUtil.BASE_PC_URL+"loginController/professionalJobLogin";
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/professionalJobLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web3Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/*from   w w w  . j a  va  2 s .  c  om*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web3Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://harlan-pc/fzaj/emergency/mobileWebApp/publicInfo/login.do?userName=zf1&userPwd=1
    // http://localhost/gssms/mobile/base/loginController/login?loginname=sysadmin&pwd=888888
    // String url = HttpUtil.BASE_PC_URL
    // + "/base/loginController/login";
    // http://localhost/gssms/mobile/loginController/baseLogin?loginname=sysadmin&pwd=888888
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/baseLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)

    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:net.evecom.android.web.Web2Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    temp = HttpUtil.getPageSize(this);
    setContentView(R.layout.message_post_web);
    imageView = (ImageView) findViewById(R.id.image_view_at_web);
    webView = (WebView) this.findViewById(R.id.wv_oauth_message);
    CookieSyncManager.createInstance(this);
    CookieSyncManager.getInstance().startSync();
    CookieManager.getInstance().removeSessionCookie();
    /**/*  w w  w  .j  a v  a2s  .com*/
     * WebViewJavaScript
     */
    webView.getSettings().setJavaScriptEnabled(true);

    /**
     * loadUrl()
     */
    webView.setWebViewClient(new HelloWebViewClient());
    dialog = ProgressDialog.show(Web2Activity.this, null, "..");
    dialog.setCancelable(true);
    // http://localhost/gssms/mobile/loginController/dailyOfficeLogin?loginname=sysadmin&pwd=888888
    String url = HttpUtil.BASE_PC_URL + "mobile/loginController/dailyOfficeLogin";
    // post
    // String postDate = "loginname=sysadmin&pwd=888888";
    String postDate = "loginname=" + ShareUtil.getString(getApplicationContext(), "SESSION", "USERNAME", "")
            + "&pwd=" + ShareUtil.getString(getApplicationContext(), "SESSION", "PASSWORD", "") + "&pageSize="
            + temp;
    // webView.postUrl(url, postData) postDatabyte[] 
    // EncodingUtils.getBytes(data, charset)
    webView.postUrl(url, EncodingUtils.getBytes(postDate, "BASE64"));
    // 
    webView.setDownloadListener(new MyWebViewDownLoadListener());
    WebSettings webSettings = webView.getSettings();
    webSettings.setSupportZoom(true);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setBuiltInZoomControls(true);// support zoom
    // webSettings.setPluginsEnabled(true);//support flash
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
    // webSettings.setPluginsEnabled(true); //(flash)
    /**  */
    // //
    webSettings.setDatabaseEnabled(true);
    String dir = this.getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
    // 
    webSettings.setGeolocationEnabled(true);
    // 
    webSettings.setGeolocationDatabasePath(dir);
    // 
    webSettings.setDomStorageEnabled(true);

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int mDensity = metrics.densityDpi;
    // DebugLog.d(TAG, "densityDpi = " + mDensity);
    if (mDensity == 240) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == 160) {
        webSettings.setDefaultZoom(ZoomDensity.MEDIUM);
    } else if (mDensity == 120) {
        webSettings.setDefaultZoom(ZoomDensity.CLOSE);
        // }else if(mDensity == DisplayMetrics..DENSITY_XHIGH){
        // webSettings.setDefaultZoom(ZoomDensity.FAR);
    } else if (mDensity == DisplayMetrics.DENSITY_HIGH) {
        webSettings.setDefaultZoom(ZoomDensity.FAR);
    }
    webView.setWebChromeClient(m_chromeClient);// (flash)

    dialogPress = new AlertDialog.Builder(this).setTitle("").setMessage(":0/0")
            .setPositiveButton("", new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}