Created
May 8, 2012 20:08
-
-
Save rduplain/2638913 to your computer and use it in GitHub Desktop.
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.willowtreeapps.demo; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.view.KeyEvent; | |
import android.view.Window; | |
import android.webkit.WebView; | |
import android.webkit.WebViewClient; | |
public class MainActivity extends Activity { | |
private WebView mWebView; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
getWindow().requestFeature(Window.FEATURE_NO_TITLE); | |
mWebView = new WebView(this); | |
mWebView.loadUrl("http://m.willowtreeapps.com/"); | |
mWebView.setWebViewClient(new WebViewClient() { | |
@Override | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
view.loadUrl(url); | |
return true; | |
} | |
}); | |
this.setContentView(mWebView); | |
} | |
@Override | |
public boolean onKeyDown(final int keyCode, final KeyEvent event) { | |
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) { | |
mWebView.goBack(); | |
return true; | |
} | |
return super.onKeyDown(keyCode, event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many users, including web or application developers, are confronting the err_cache_miss consistently in Google Chrome browser.