我有成功显示html的代码
import java.io.DataInputStream;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Example extends MIDlet implements CommandListener {
.
.
.
.
.
private String requestUsingGET(String URLString) throws IOException {
HttpConnection hpc = null;
DataInputStream dis = null;
boolean newline = false;
String content = "";
try {
hpc = (HttpConnection) Connector.open(URLString);
dis = new DataInputStream(hpc.openInputStream());
int character;
while ((character = dis.read()) != -1) {
if ((char) character == '\\') {
newline = true;
continue;
} else {
if ((char) character == 'n' && newline) {
content += "\n";
newline = false;
} else if (newline) {
content += "\\" + (char) character;
newline = false;
} else {
content += (char) character;
newline = false;
}
}
}
if (hpc != null)
hpc.close();
if (dis != null)
dis.close();
} catch (IOException e2) {
}
return content;
}
}
但除了我想在我的代码中显示WAP.what
以添加此内容之外?
显示WAP浏览器。
因为当我试图解决wap.yahoo.com
时,系统没有回复。