功能介绍:
1、服务端:手机端新建线程,创建serverSocket监听8080端口;
2、客户端:使用webView的方法loadURl(“http://172.0.0.1:8080“)访问本地;
下载地址:http://download.csdn.net/detail/youngwm/9438042
一、在布局文件xml创建webView对象:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hint_str"
android:layout_margin="10dp"/>
<EditText
android:id="@+id/edit_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_str1"
android:layout_margin="10dp"/>
<Button
android:id="@+id/btn_change_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onClick"
android:layout_margin="10dp"
android:text="@string/btn_str"/>
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
public class MainActivity