1.WebView 首先在activity_main.xml中修改
<WebView android:id="@+id/web_view" android:layout_width="match_parent" android:layout_height="match_parent"/>然后我们只需要在MainActivity中
WebView webView = (WebView)findViewById(R.id.web_view); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WenViewClient()); webView.loadUrl("http://www.baidu.com");对于Android中的Http的协议首先
URL url = new URL("http://www.baidu.com"); HttpURLConnection connection = (HttpURLConnection) url.openConnection();在得到了HttpURLConnection实例后,我们需要设置HTTP的请求方式,通常有两种GET和POST
connection.setConnectTimeout(8000);//一些设置 connection.setReadTimeout(8000); InputStream in = connection.getInputStream();//得到服务器返回的输入流 connection.disconnect();
sax解析 JSON GSON