我有以下问题。当我在模拟器中执行它时,这个 midlet 工作正常,但是当我将它上传到我的摩托罗拉 i290(与 nextel 公司)并启动它时,它会冻结。所以永远不会启动(程序开始向 php 页面发出请求)
这是代码,如果有人知道为什么我的程序在 Wireless Toolkit 模拟器中运行良好而不是在手机中运行良好,请告诉我。谢谢
这是我的“连接”方法
String getGrade(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
StringBuffer b = new StringBuffer();
TextBox t = null;
int x = 5, y =7;
try {
c = (HttpConnection)Connector.open(url,Connector.READ,true);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-2.0 Confirguration/CLDC-1.1");
c.setRequestProperty("Content-Language", "en-CA");
os = c.openOutputStream();
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1) {
b.append((char) ch);
System.out.println((char)ch);
}
t = new TextBox("Final Grades", b.toString(), 1024, 0);
} finally {
if(is!= null) {
is.close();
}
if(os != null) {
os.close();
}
if(c != null) {
c.close();
}
}
//display.setCurrent(t);
return b.toString();
}