?? updateuserdatathread.java
字號(hào):
import javax.microedition.io.*;
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.* ;
public class UpdateUserDataThread extends Thread
{
String url ;
public UpdateUserDataThread(String url,String id,String pw,String ds)
{
String enc = System.getProperty("microedition.encoding") ;
System.out.println("系統(tǒng)使用的編碼:"+enc) ;
this.url = url+"?id="+id+"&pw="+pw+"&ds="+ds ;
System.out.println("準(zhǔn)備連接:"+this.url) ;
}
public void run()
{
boolean error = false ;
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
DataInputStream dos = null ;
String line = "" ;
try
{
c = (HttpConnection)Connector.open(url);
System.out.println("回傳碼:" + c.getResponseCode()) ;
is = c.openInputStream();
dos = new DataInputStream(is) ;
line = dos.readUTF() ;
}catch (EOFException e)
{
System.out.println("接收到的響應(yīng):" + line) ;
}catch (Exception e)
{
error = true ;
Alert al = new Alert("更新時(shí)期發(fā)生錯(cuò)誤",e.toString(),null,AlertType.ALARM) ;
al.setTimeout(Alert.FOREVER) ;
Navigator.display.setCurrent(al) ;
}finally
{
try
{
if (is != null)
is.close();
if (os != null)
os.close();
if (c != null)
c.close();
}catch(Exception e){}
}
if(!error)
{
Alert al = new Alert("更新結(jié)果",line,null,AlertType.CONFIRMATION) ;
al.setTimeout(Alert.FOREVER) ;
Navigator.display.setCurrent(al) ;
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -