Tag Archives: webview

3,717 views

xml string with html tags Android

// in strings.xml <string name="myStringWithTags"><![CDATA[<b>some text..</b> other tags …]]></string> <string name="myStringWithPattern"><![CDATA[<b>%s</b> other tags …]]></string> // in Activity.class String sHtmlText = this.getApplicationContext().getString(R.string.myStringTags); sHtmlText = this.getApplicationContext().getString(R.string.myStringWithPattern,"replace %s with this text");

Posted in Android Examples Code | Tagged , , , | Comments Off on xml string with html tags Android
6,842 views

WebView.loadData utf-8 encoding Android

Try this solution: String DATA = "Html text….bla bla bla. Hellou world! čšřžěéá"; String HEADERHTML = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" +"<html> <head> <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">" +"</head> <body>"; String FOOTERHTML = "</body></html>"; WebView mWebView.loadData(HEADERHTML+DATA+FOOTERHTML,"text/html; charset=UTF-8",null);

Posted in Android Examples Code | Tagged | Comments Off on WebView.loadData utf-8 encoding Android
2,097 views

Create Image From View Screen Android

WebView_webview = (WebView)findViewById(R.id.webViewMapa); _webview.getSettings().setBuiltInZoomControls(true); _webview.setBackgroundColor(Color.parseColor("#E8EAE8")); // _webview.loadUrl( … some your page   Bitmap b = Bitmap.createBitmap(_webview.getWidth()/2, _webview.getHeight(), Bitmap.Config.ARGB_8888); // you can to draw on bitmap Canvas c = new Canvas(b); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth(15.f); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); //paint.setShadowLayer(5.f, 0, … Continue reading

Posted in Android Examples Code | Tagged , , | Comments Off on Create Image From View Screen Android
52,798 views

Get Assets folder path and read txt file to string Android example code

Programmatically load text from Asset folder file myData.txt to string Android example source code. Read file to byte[] buffer and convert into string Android example. Assets folder path may be: c:\documents\_android_projects\MyProject\assets // Path for a WebView String sAssets = "file:///android_asset/" … Continue reading

Posted in Android Examples Code | Tagged , , , , , , | Comments Off on Get Assets folder path and read txt file to string Android example code