Skip to content

Instantly share code, notes, and snippets.

@halidaltuner
Created February 24, 2011 15:11
Show Gist options
  • Save halidaltuner/842267 to your computer and use it in GitHub Desktop.
Save halidaltuner/842267 to your computer and use it in GitHub Desktop.
Wrapper Based Simple Android Application ( via Google Reader )
package com.kulucka.googlereaderwrapper;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class GoogleReaderWrapper extends Activity
{
final Activity activity = this;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
WebView webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setGeolocationEnabled(false);
webview.getSettings().setSaveFormData(true);
webview.getSettings().setSavePassword(true);
webview.getSettings().setSupportMultipleWindows(false);
webview.getSettings().setSupportZoom(false);
webview.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle(R.string.app_name);
}
});
webview.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
webview.loadUrl("http://www.google.com/reader/i");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment