如题
解决方案 »
- android程序里面嵌入网页,网页里面是silverlight,是否可行?
- Cygwin,NDK编译动态库问题。
- 为什么我新建一个xml文件,android系统总是报错
- Android模拟器可以跑mips下的镜像嘛
- 急!!android编译遇到java.lang.OutOfMemoryError: GC overhead limit exceeded错误
- android spinner
- 如何响应 乐phone的默认“返回”按钮
- OpenGL ES2.0在onDrawFrame用线程画图可以吗?
- ViewPager 拖动fragment变卡是怎么回事?
- 是utf-8编码能兼容部分'中文编码'?
- 修改代码后,无法启动
- 关于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参数里, 然后在服务器端判断就可以