1.Web.java
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Web extends Activity {
WebView mWebView;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.web);
mWebView=(WebView)findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebChromeClient(new WebChromeClient());
}
private class mWebViewClient extends WebViewClient{
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return true;
}
}
public boolean onKeyDown(int keyCode, KeyEvent event){
if((keyCode==KeyEvent.KEYCODE_BACK)&&mWebView.canGoBack()){
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode,event);
}
}
2.web.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/webview"/>
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/ZoomArea"
android:gravity="bottom|right"
android:layout_gravity="bottom">
</LinearLayout>
</FrameLayout>
3.안드로이드 매니페스트
<uses-permission android:name="android.permission.INTERNET"/> 와 web.xml 액티비티 추가
이렇게 웹뷰를 하고 다른 자바클래스에서 이미지버튼을 클릭하면 web.java로 연결되서 인터넷이 연결되게 하려고 하는데요
else if (v.getId() == R.id.ImageView01){
prof_1.this.onPause();
Intent newActivity2 = new Intent(prof_1.this,Web.class);
prof_1.this.startActivity(newActivity2);
} 이런식으로 추가..
그런데 에뮬 띄어놓으면 이미지 클릭시 아무런 변화가 없습니다..... 어떤부분이 잘못된걸까요?ㅠ