当前位置: 代码迷 >> Java相关 >> android与c#通过socket传输图片,该怎么处理
  详细解决方案

android与c#通过socket传输图片,该怎么处理

热度:2138   发布时间:2013-02-25 21:51:46.0
android与c#通过socket传输图片
java的部分代码:
public Bitmap sendMsg(String msg)
{
try
{
PrintWriter out = new PrintWriter(socket1.getOutputStream());
out.println(msg);
out.flush();
InputStream ips = socket1.getInputStream();
return BitmapFactory.decodeStream(ips);
}
catch(IOException e)
{
e.printStackTrace();
}
return null;
}

执行完return BitmapFactory.decodeStream(ips);后会跳到return null;返回null,为什么?
没有发生和捕捉到异常。

------解决方案--------------------------------------------------------
你把catch(IOException e)

的IOException 改为Exception 试试,可能不是IOException 异常
  相关解决方案