如题
解决方案 »
- 新手学习Android要多长时间
- adb devices为何一个设备没有名字:(
- android 使用ListView实现列表,列表中有checkBox,TextView,需实现点击这两个控件能触发不同的动作
- 跨移动平台游戏开发的疑问
- android方面的好书推荐下哦
- 哪位大侠给指点一下,按钮设置外观的问题
- android tabhost如何设置标签的间距
- eclipse有没有工具分析继承关系?
- AES加密解密,在android上加密解密成功,在android上加密成功Java服务器上解密失败,求各位大神帮帮忙
- [StatusBar/SystemUI]懂状态栏的大侠我请你们喝酒
- 修改代码后,无法启动
- 关于android中listview的滑动流畅度优化问题
myEdit.setText("here is the path:"+path);
//create a url
String urlStr="127.0.0.1?";
String namepwd="?username=***&password=***";
urlStr+=uuid;
try{
URL url=new URL(urlStr);
HttpURLConnection conn=(HttpURLConnection)url.openConnection();
if(conn.getResponseCode()==HttpURLConnection.HTTP_OK){
InputStream in=conn.getInputStream();
byte[] b=new byte[in.available()];
in.read(b);
String msg=new String(b);
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
in.close();
}
conn.disconnect();
}catch(Exception e){
e.printStackTrace();
}直把username password写在url参数里, 然后在服务器端判断就可以