Share Coding

Tutorials, Problems, Stuffs …

Return value from JavaScript to Android Webview

WebView WebView1 = new WebView(this);
private WebChromeClient MyWebChromeClient = new WebChromeClient() {
	public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
		try {
			// "message" is the text shown in alert box
			Log.v("message",, "UTF-8"));
		} catch (UnsupportedEncodingException e) {
		return true;
//If the "message" text is garbled, you can try to add this on php header: ini_set('default_charset','utf-8');

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: