안드로이드 개발 질문/답변
(글 수 45,052)
책에 나와있는 WebView예제를 해봤는데 에뮬레이터 상에서는 접속이 되지가 않더라구요. 권한이 확보가 되지 않는거 같은데.
권한 설정은 해줬구여. 소스를 올릴테니 한번봐주세요.
Java파일.
public class Main extends Activity{
WebView browser;
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.webview);
browser = (WebView)findViewById(R.id.webkit);
browser.loadUrl("http://www.acornpub.co.kr");
}
}
webview.xml 파일
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <WebView android:id="@+id/webkit" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
Androidmanifest.xml 파일
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mobile.android"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity
android:name=".Main"
android:label="Main"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
에러화면




저도 처음에 노트북의 무선으로하니 그러더라고요
노트북은 유선으로 연결시켜야 에뮬의 통신이 정상동작하더라는..