Posted by Security is just an illusion at Monday, January 28, 2013
Read our previous post
I wrote a simple Blog Reader for Android.
Its very very simple its load the url into a webview.
MainActivity.java
package com.woot.securityisjustanillusion;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
final Context context = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(context, WebViewActivity.class);
startActivity(intent);
MainActivity.this.finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
WebViewActivity.java
package com.woot.securityisjustanillusion;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebViewActivity extends Activity{
WebView webView;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView1);
gotoPage();
};
private void gotoPage(){
WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webView.setWebViewClient(new Callback());
webView.loadUrl("http://security-is-just-an-illusion.blogspot.de");
}
private class Callback extends WebViewClient{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return (false);
}
}
}
Have pfun ….
No comments:
Post a Comment