皆さん。私はここに新しいです、これは私の最初の投稿です。 私はウェブのコンテンツを取る簡単なアプリケーションを作成しています。以下は私のコードです。問題は、シミュレータでこれを実行することができないということです。エラーもダイアログボックスもなく、完全に開くことはできません。私を助けることができる誰でも....ブラックベリーアプリケーションはシミュレータで開くことができません
import java.io.InputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class HTTPClient extends UiApplication {
LabelField test;
MainScreen screen = new MainScreen();
public static void main(String[] args)
{
HTTPClient theApp = new HTTPClient();
theApp.enterEventDispatcher();
}
public HTTPClient()
{
getPage("http://google.com");
}
public void getPage(String url) {
String response = "";
try {
StreamConnection s = (StreamConnection)Connector.open(url);
InputStream input = s.openInputStream();
byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();
while(-1 != (len = input.read(data))) {
raw.append(new String(data, 0, len));
}
response = raw.toString();
show(response);
input.close();
s.close();
} catch(Exception e) { }
}
public void show(String response) {
test = new LabelField(response);
screen.add(test);
pushScreen(screen);
}
}
ルック:あなたのコードについては
は、私が言及した要件を満たすためにそれを修正しましたBBシミュレータ上で – mrvincenzoBBシミュレータの「イベントログ」(BBシミュレータ - >ツール - >イベントログの表示)で「例外」を探すこともできます。 – mrvincenzo
@ error.exit例外です。java.io.InterruptedIOException:〜12000の後にローカル接続がタイムアウトしました – blazaphyrocqua