Back to project page pocket4android.
The source code is released under:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includin...
If you think the Android project pocket4android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.hyperionics.PocketTest; //from www.j a va2 s . c om import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; /** * Created by greg on 11/5/13. */ public class SimpleBrowser extends Activity { protected WebView webView; private class SimpleWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url == null || !url.startsWith("pocketapp")) { view.loadUrl(url); } else { SimpleBrowser.this.finish(); PocketActivity.getCurrent().onAuthorizationFinished(null); } return true; } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.browser); webView = (WebView) findViewById(R.id.webkit); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webView.setWebViewClient(new SimpleWebViewClient()); android.webkit.CookieManager.getInstance().setAcceptCookie(true); Intent intent = getIntent(); if (intent != null) { String sUrl = intent.getStringExtra("url"); if (sUrl != null) webView.loadUrl(sUrl); } } }