Created
January 20, 2016 07:54
-
-
Save a1yama/211cc0d051297c66db81 to your computer and use it in GitHub Desktop.
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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
context = getApplicationContext(); | |
gcm = GoogleCloudMessaging.getInstance(this); | |
registerInBackground(); | |
webView = (WebView) findViewById(R.id.webview); | |
webView.setWebViewClient(new WebViewClient() { | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
if (!url.startsWith("file:") && !url.startsWith("http:") && !url.startsWith("https:")) { | |
webView.stopLoading(); | |
Intent intent = new Intent(getApplication(), InfoActivity.class); | |
startActivity(intent); | |
return true; | |
} | |
return super.shouldOverrideUrlLoading(view, url); | |
} | |
}); | |
webView.loadUrl("http://hoge.jp/"); | |
webView.getSettings().setJavaScriptEnabled(true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment