我正在尝试构建远程桌面应用程序。好吧,我可以使用Csharp Server和Client Applications上的binaryformatter序列化/反序列化在流上成功传输位图。但是我的主要目标是将位图从PC转移到android应用程序,但是我找不到在Android上反序列化流的任何替代方法。
是的,你可以那样做。
如果您将Xamarin表单用于android,则可以使用cSharp将流转换为位图。
对于本机Android,您可以尝试,
HttpGet httpRequest = null;
try {
httpRequest = new HttpGet(url.toURI());
} catch (URISyntaxException e) {
e.printStackTrace();
}
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();
bmp = BitmapFactory.decodeStream(instream);
您可以根据自己的需要修改代码。
希望它对您有用。