package com.example.mybrowser;

import android.app.Activity;
import android.os.Bundle;
import android.provider.SyncStateContract.Constants;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;

public class MainActivity extends Activity {

	private WebView mWebView;
	
	private static final String INITIAL_WEBSITE = "http://www.google.co.jp";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		mWebView = (WebView)findViewById(R.id.webView1);
		mWebView.loadUrl(INITIAL_WEBSITE);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}

@@ -25,16 +25,56 @@
 owser;%0A%0A
+import android.annotation.SuppressLint;%0A
 import a
@@ -259,16 +259,53 @@
 WebView;
+%0Aimport android.webkit.WebViewClient;
 %0A%0Apublic
@@ -449,16 +449,55 @@
 .jp%22;%0A%09%0A
+%09@SuppressLint(%22SetJavaScriptEnabled%22)%0A
 %09@Overri
@@ -702,36 +702,410 @@
 iew.
-loadUrl(INITIAL_WEBSITE);%0A%09%7D
+getSettings().setJavaScriptEnabled(true);%0A%09%09mWebView.setWebViewClient(new WebViewClient());%0A%09%09mWebView.loadUrl(INITIAL_WEBSITE);%0A%09%09%0A%09%7D%0A%09%0A%09%0A%0A%09@Override%0A%09public void onBackPressed() %7B%0A%09%09if(mWebView.canGoBack())%7B%0A%09%09%09mWebView.goBack();%0A%09%09%09return;%0A%09%09%7D%0A%09%09else%7B%0A%09%09%09super.onBackPressed();%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09protected void onDestroy() %7B%0A%09%09super.onDestroy();%0A%09%09mWebView.stopLoading();%0A%09%09mWebView.destroy();%0A%09%7D%0A
 %0A%0A%09@

戻るボタン、終了時処理等