Created
February 24, 2011 15:11
-
-
Save halidaltuner/842267 to your computer and use it in GitHub Desktop.
Wrapper Based Simple Android Application ( via Google Reader )
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.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