我正在为我的BlackBerry编写一个小应用程序,我需要将一些数据发送到网页(通过GET或POST)
有没有人可以建议如何使用BlackBerry来做这件事。
发布于 2010-06-12 23:05:57
你需要javax.microedition.io.HttpConnection来做这件事。链接的javadoc包含GET和POST的基本代码示例。下面是GET示例的摘录:
void getViaStreamConnection(String url) throws IOException {
StreamConnection c = null;
InputStream s = null;
try {
c = (StreamConnection)Connector.open(url);
s = c.openInputStream();
int ch;
while ((ch = s.read()) != -1) {
...
}
} finally {
if (s != null)
s.close();
if (c != null)
c.close();
}
}https://stackoverflow.com/questions/3029069
复制相似问题