Example usage for org.apache.http.util EncodingUtils getBytes

List of usage examples for org.apache.http.util EncodingUtils getBytes

Introduction

In this page you can find the example usage for org.apache.http.util EncodingUtils getBytes.

Prototype

public static byte[] getBytes(String str, String str2) 

Source Link

Usage

From source file:net.niyonkuru.koodroid.webview.BlockingWebView.java

public void postOnUiThread(final String url, final String postData) {
    if (DEBUG)/* w  w w.  j av a  2 s .  co  m*/
        Log.i(TAG, "POST: " + url + "?" + postData);

    mHandler.post(new Runnable() {
        @Override
        public void run() {
            postUrl(url, EncodingUtils.getBytes(postData, "BASE64"));
        }
    });
}

From source file:com.prey.activities.PanelWebActivity.java

@Override
public void onResume() {
    super.onResume();
    WebSettings settings = myWebView.getSettings();
    settings.setUseWideViewPort(true);//w w  w.j a  v a 2s.c  om
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    myWebView.setVerticalScrollBarEnabled(false);
    myWebView.setHorizontalScrollBarEnabled(false);
    myWebView.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);

            if (progress == 100)
                activity.setTitle(R.string.app_name);
        }

    });
    myWebView.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {
            PreyLogger.d("Finished:" + url);
            super.onPageFinished(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            PreyLogger.d("Started:" + url);
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            PreyLogger.d("OverrideUrl:" + url);
            return super.shouldOverrideUrlLoading(view, url);
        }
    });

    String url = PreyConfig.getPreyConfig(getApplicationContext()).getPreyPanelJwt();

    String postData = "token=" + PreyConfig.getPreyConfig(getApplicationContext()).getTokenJwt();
    ;

    byte[] postByte = EncodingUtils.getBytes(postData, "BASE64");
    myWebView.postUrl(url, postByte);
}

From source file:org.chromium.android_webview.test.AwContentsClientOnFormResubmissionTest.java

protected void doReload() throws Throwable {
    String url = mServer.setResponse("/form", LOAD_RESPONSE, null);
    String postData = "content=blabla";
    byte[] data = EncodingUtils.getBytes(postData, "BASE64");
    postUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), url, data);
    assertEquals(0, mContentsClient.getResubmissions());
    assertEquals("Load", getTitleOnUiThread(mAwContents));
    // Verify reload works as expected.
    mServer.setResponse("/form", RELOAD_RESPONSE, null);
    TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = mContentsClient
            .getOnPageFinishedHelper();//from   w w w. j  a v  a 2s. co m
    int callCount = onPageFinishedHelper.getCallCount();
    // Run reload on UI thread.
    getInstrumentation().runOnMainSync(new Runnable() {
        @Override
        public void run() {
            mAwContents.getContentViewCore().reload(true);
        }
    });
    try {
        // Wait for page finished callback, or a timeout. A timeout is necessary
        // to detect a dontResend response.
        onPageFinishedHelper.waitForCallback(callCount, 1, TIMEOUT, TimeUnit.SECONDS);
    } catch (TimeoutException e) {
        // Exception expected from testDontResend case.
    }
}

From source file:com.jfrog.bintray.client.impl.util.URIUtil.java

/**
 * Escape and encode a given string with allowed characters not to be
 * escaped and a given charset./*ww  w .java  2 s .  co m*/
 *
 * @param unescaped a string
 * @param allowed   allowed characters not to be escaped
 * @param charset   the charset
 * @return the escaped string
 */
public static String encode(String unescaped, BitSet allowed, String charset) throws HttpException {
    byte[] rawdata = URLCodec.encodeUrl(allowed, EncodingUtils.getBytes(unescaped, charset));
    return EncodingUtils.getAsciiString(rawdata);
}

From source file:com.remdo.app.WebViewActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_web_view);

    // Get the uri from the intent
    Intent intent = getIntent();/*from   w  w w  . ja v  a2  s. co m*/
    String uriToDisplay = intent.getStringExtra("DEVICE_URL");
    String usr = intent.getStringExtra("DEVICE_USER");
    String pwd = intent.getStringExtra("DEVICE_PASSWORD");
    Integer odTypeId = intent.getIntExtra("DEVICE_ODTYPEID", -1);

    if (odTypeId == 1)//ODNetWork    
    {
        if (!uriToDisplay.contains("cgi-bin/od.cgi")) {
            uriToDisplay = uriToDisplay.concat("/cgi-bin/od.cgi");
        }

        //initialize WebView
        webView = (WebView) findViewById(R.id.webView1);
        //we should define a webview client to get user navigation inside our webview otherwise 
        //defaul behaviour will open a webbrowser on first click
        webView.setWebViewClient(new WebViewClient());

        try {

            byte[] post = EncodingUtils.getBytes("USERNAME=" + usr + "&PASSWORD=" + pwd, "BASE64");
            webView.postUrl(uriToDisplay, post);

        } catch (Exception e) {
            String message = e.getMessage();
        }
    } else//ODControl
    {
        webView = (WebView) findViewById(R.id.webView1);

        webView.setHttpAuthUsernamePassword(uriToDisplay, "/", "user@opendomo.com", "opendomo");
        webView.setWebChromeClient(new WebChromeClient());
        webView.setWebViewClient(new MyWebViewClient());
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://local.opendomo.com");

    }

}

From source file:local.apache.StringPart.java

/**
 * Gets the content in bytes.  Bytes are lazily created to allow the charset to be changed
 * after the part is created./*from  w  w  w . j ava  2 s  . c o m*/
 *
 * @return the content in bytes
 */
private byte[] getContent() {
    if (this.content == null) {
        this.content = EncodingUtils.getBytes(this.value, getCharSet());
    }
    return this.content;
}

From source file:com.android.internal.http.multipart.StringPart.java

/**
 * Gets the content in bytes.  Bytes are lazily created to allow the charset to be changed
 * after the part is created./*from w w  w. j  a va 2 s .c om*/
 * 
 * @return the content in bytes
 */
private byte[] getContent() {
    if (content == null) {
        content = EncodingUtils.getBytes(value, getCharSet());
    }
    return content;
}

From source file:org.apache.axis2.transport.http.HTTPWorker.java

public void service(final AxisHttpRequest request, final AxisHttpResponse response,
        final MessageContext msgContext) throws HttpException, IOException {
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();
    final String servicePath = configurationContext.getServiceContextPath();
    final String contextPath = (servicePath.startsWith("/") ? servicePath : "/" + servicePath) + "/";

    String uri = request.getRequestURI();
    String method = request.getMethod();
    String soapAction = HttpUtils.getSoapAction(request);
    InvocationResponse pi;//from  www .j  ava2 s  . c  o  m

    if (method.equals(HTTPConstants.HEADER_GET)) {
        if (uri.equals("/favicon.ico")) {
            response.setStatus(HttpStatus.SC_MOVED_PERMANENTLY);
            response.addHeader(new BasicHeader("Location", "http://ws.apache.org/favicon.ico"));
            return;
        }
        if (!uri.startsWith(contextPath)) {
            response.setStatus(HttpStatus.SC_MOVED_PERMANENTLY);
            response.addHeader(new BasicHeader("Location", contextPath));
            return;
        }
        if (uri.endsWith("axis2/services/")) {
            String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
            response.setStatus(HttpStatus.SC_OK);
            response.setContentType("text/html");
            OutputStream out = response.getOutputStream();
            out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1));
            return;
        }
        if (uri.indexOf("?") < 0) {
            if (!uri.endsWith(contextPath)) {
                if (uri.endsWith(".xsd") || uri.endsWith(".wsdl")) {
                    HashMap services = configurationContext.getAxisConfiguration().getServices();
                    String file = uri.substring(uri.lastIndexOf("/") + 1, uri.length());
                    if ((services != null) && !services.isEmpty()) {
                        Iterator i = services.values().iterator();
                        while (i.hasNext()) {
                            AxisService service = (AxisService) i.next();
                            InputStream stream = service.getClassLoader()
                                    .getResourceAsStream("META-INF/" + file);
                            if (stream != null) {
                                OutputStream out = response.getOutputStream();
                                response.setContentType("text/xml");
                                ListingAgent.copy(stream, out);
                                out.flush();
                                out.close();
                                return;
                            }
                        }
                    }
                }
            }
        }
        if (uri.endsWith("?wsdl2")) {
            String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 6);
            HashMap services = configurationContext.getAxisConfiguration().getServices();
            AxisService service = (AxisService) services.get(serviceName);
            if (service != null) {
                boolean canExposeServiceMetadata = canExposeServiceMetadata(service);
                if (canExposeServiceMetadata) {
                    response.setStatus(HttpStatus.SC_OK);
                    response.setContentType("text/xml");
                    service.printWSDL2(response.getOutputStream(), getHost(request));
                } else {
                    response.setStatus(HttpStatus.SC_FORBIDDEN);
                }
                return;
            }
        }
        if (uri.endsWith("?wsdl")) {
            /**
             * service name can be hierarchical (axis2/services/foo/1.0.0/Version?wsdl) or
             * normal (axis2/services/Version?wsdl).
             */
            String[] temp = uri.split(configurationContext.getServiceContextPath() + "/");
            String serviceName = temp[1].substring(0, temp[1].length() - 5);

            HashMap services = configurationContext.getAxisConfiguration().getServices();
            AxisService service = (AxisService) services.get(serviceName);
            if (service != null) {
                boolean canExposeServiceMetadata = canExposeServiceMetadata(service);
                if (canExposeServiceMetadata) {
                    response.setStatus(HttpStatus.SC_OK);
                    response.setContentType("text/xml");
                    service.printWSDL(response.getOutputStream(), getHost(request));
                } else {
                    response.setStatus(HttpStatus.SC_FORBIDDEN);
                }
                return;
            }
        }
        if (uri.endsWith("?xsd")) {
            String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 4);
            HashMap services = configurationContext.getAxisConfiguration().getServices();
            AxisService service = (AxisService) services.get(serviceName);
            if (service != null) {
                boolean canExposeServiceMetadata = canExposeServiceMetadata(service);
                if (canExposeServiceMetadata) {
                    response.setStatus(HttpStatus.SC_OK);
                    response.setContentType("text/xml");
                    service.printSchema(response.getOutputStream());
                } else {
                    response.setStatus(HttpStatus.SC_FORBIDDEN);
                }
                return;
            }
        }
        //cater for named xsds - check for the xsd name
        if (uri.indexOf("?xsd=") > 0) {
            // fix for imported schemas
            String[] uriParts = uri.split("[?]xsd=");
            String serviceName = uri.substring(uriParts[0].lastIndexOf("/") + 1, uriParts[0].length());
            String schemaName = uri.substring(uri.lastIndexOf("=") + 1);

            HashMap services = configurationContext.getAxisConfiguration().getServices();
            AxisService service = (AxisService) services.get(serviceName);
            if (service != null) {
                boolean canExposeServiceMetadata = canExposeServiceMetadata(service);
                if (!canExposeServiceMetadata) {
                    response.setStatus(HttpStatus.SC_FORBIDDEN);
                    return;
                }
                //run the population logic just to be sure
                service.populateSchemaMappings();
                //write out the correct schema
                Map schemaTable = service.getSchemaMappingTable();
                XmlSchema schema = (XmlSchema) schemaTable.get(schemaName);
                if (schema == null) {
                    int dotIndex = schemaName.indexOf('.');
                    if (dotIndex > 0) {
                        String schemaKey = schemaName.substring(0, dotIndex);
                        schema = (XmlSchema) schemaTable.get(schemaKey);
                    }
                }
                //schema found - write it to the stream
                if (schema != null) {
                    response.setStatus(HttpStatus.SC_OK);
                    response.setContentType("text/xml");
                    schema.write(response.getOutputStream());
                    return;
                } else {
                    InputStream instream = service.getClassLoader()
                            .getResourceAsStream(DeploymentConstants.META_INF + "/" + schemaName);

                    if (instream != null) {
                        response.setStatus(HttpStatus.SC_OK);
                        response.setContentType("text/xml");
                        OutputStream outstream = response.getOutputStream();
                        boolean checkLength = true;
                        int length = Integer.MAX_VALUE;
                        int nextValue = instream.read();
                        if (checkLength)
                            length--;
                        while (-1 != nextValue && length >= 0) {
                            outstream.write(nextValue);
                            nextValue = instream.read();
                            if (checkLength)
                                length--;
                        }
                        outstream.flush();
                        return;
                    } else {
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        int ret = service.printXSD(baos, schemaName);
                        if (ret > 0) {
                            baos.flush();
                            instream = new ByteArrayInputStream(baos.toByteArray());
                            response.setStatus(HttpStatus.SC_OK);
                            response.setContentType("text/xml");
                            OutputStream outstream = response.getOutputStream();
                            boolean checkLength = true;
                            int length = Integer.MAX_VALUE;
                            int nextValue = instream.read();
                            if (checkLength)
                                length--;
                            while (-1 != nextValue && length >= 0) {
                                outstream.write(nextValue);
                                nextValue = instream.read();
                                if (checkLength)
                                    length--;
                            }
                            outstream.flush();
                            return;
                        }
                        // no schema available by that name  - send 404
                        response.sendError(HttpStatus.SC_NOT_FOUND, "Schema Not Found!");
                        return;
                    }
                }
            }
        }
        if (uri.indexOf("?wsdl2=") > 0) {
            String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("?wsdl2="));
            if (processInternalWSDL(uri, configurationContext, serviceName, response, getHost(request)))
                return;
        }
        if (uri.indexOf("?wsdl=") > 0) {
            String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.lastIndexOf("?wsdl="));
            if (processInternalWSDL(uri, configurationContext, serviceName, response, getHost(request)))
                return;
        }

        String contentType = null;
        Header[] headers = request.getHeaders(HTTPConstants.HEADER_CONTENT_TYPE);
        if (headers != null && headers.length > 0) {
            contentType = headers[0].getValue();
            int index = contentType.indexOf(';');
            if (index > 0) {
                contentType = contentType.substring(0, index);
            }
        }

        // deal with GET request
        pi = RESTUtil.processURLRequest(msgContext, response.getOutputStream(), contentType);

    } else if (method.equals(HTTPConstants.HEADER_POST)) {
        // deal with POST request

        String contentType = request.getContentType();

        if (HTTPTransportUtils.isRESTRequest(contentType)) {
            pi = RESTUtil.processXMLRequest(msgContext, request.getInputStream(), response.getOutputStream(),
                    contentType);
        } else {
            String ip = (String) msgContext.getProperty(MessageContext.TRANSPORT_ADDR);
            if (ip != null) {
                uri = ip + uri;
            }
            pi = HTTPTransportUtils.processHTTPPostRequest(msgContext, request.getInputStream(),
                    response.getOutputStream(), contentType, soapAction, uri);
        }

    } else if (method.equals(HTTPConstants.HEADER_PUT)) {

        String contentType = request.getContentType();
        msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);

        pi = RESTUtil.processXMLRequest(msgContext, request.getInputStream(), response.getOutputStream(),
                contentType);

    } else if (method.equals(HTTPConstants.HEADER_DELETE)) {

        pi = RESTUtil.processURLRequest(msgContext, response.getOutputStream(), null);

    } else {
        throw new MethodNotSupportedException(method + " method not supported");
    }

    Boolean holdResponse = (Boolean) msgContext.getProperty(RequestResponseTransport.HOLD_RESPONSE);
    if (pi.equals(InvocationResponse.SUSPEND) || (holdResponse != null && Boolean.TRUE.equals(holdResponse))) {
        try {
            ((RequestResponseTransport) msgContext.getProperty(RequestResponseTransport.TRANSPORT_CONTROL))
                    .awaitResponse();
        } catch (InterruptedException e) {
            throw new IOException("We were interrupted, so this may not function correctly:" + e.getMessage());
        }
    }

    // Finalize response
    RequestResponseTransport requestResponseTransportControl = (RequestResponseTransport) msgContext
            .getProperty(RequestResponseTransport.TRANSPORT_CONTROL);

    if (TransportUtils.isResponseWritten(msgContext)
            || ((requestResponseTransportControl != null) && requestResponseTransportControl.getStatus()
                    .equals(RequestResponseTransport.RequestResponseTransportStatus.SIGNALLED))) {
        // The response is written or signalled.  The current status is used (probably SC_OK).
    } else {
        // The response may be ack'd, mark the status as accepted.
        response.setStatus(HttpStatus.SC_ACCEPTED);
    }
}

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. c o  m
     * 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();
}

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();
    /**/*from w  ww . j a va 2s.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();
}