返回的InputStream在设备黑莓空 [英] InputStream return null in device blackberry

查看:178
本文介绍了返回的InputStream在设备黑莓空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这样的黑莓连接类获得的InputStream

I am getting the inputstream using the connection class in blackberry like this

HttpConnection httpConnection = new HttpConnection("http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml");
InputStream is = httpConnection.StreamConnection();

它运作良好的模拟器,但是当在设备上运行的输入流返回null。可以告诉这个问题的解决方案。先谢谢了。

it works well in simulator, but the input stream returns null when run at device. Can please tell the solution for this problem. Thanks in advance.

推荐答案

在实际的设​​备,你需要添加相应的URL参数,根据您所使用的连接类型(WIFI / BES / BIS / WAP2 / TCP)。

On real device you need to append appropriate URL parameter according to connection type(WiFi/BES/BIS/WAP2/TCP) you are using.

    For example if you are using BES connection:

    streamConn = (StreamConnection)Connector.open("http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml;deviceside=false");

and if your are using WiFi:

    streamConn = (StreamConnection)Connector.open("http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml;deviceside=true;interface=wifi");

and For WAP2/TCP:

        streamConn = (StreamConnection)Connector.open("http://www.bankofcanada.ca/rss/fx/noon/fx-noon-all.xml;deviceside=true");

这篇关于返回的InputStream在设备黑莓空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆