http 请求示例

来源:互联网 发布:windows xp摄像头驱动 编辑:程序博客网 时间:2024/04/30 08:01
HttpGet request = new HttpGet("http://www.ineeke.com/android/android.php?name="+etName.getText().toString()+"&pwd="+etPwd.getText().toString());try {HttpResponse response = new DefaultHttpClient().execute(request);if(response.getStatusLine().getStatusCode() == 200){String result = EntityUtils.toString(response.getEntity());Toast.makeText(Main.this, result, Toast.LENGTH_LONG).show();} } catch (Exception e) { Toast.makeText(Main.this, e.getMessage().toString(), Toast.LENGTH_LONG).show();e.printStackTrace();}

原创粉丝点击