?? contactlistdemo.java
字號:
import java.io.DataOutputStream;
import java.io.IOException;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class ContactListDemo extends MIDlet {
public ContactListDemo(){
super();
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
protected void startApp() throws MIDletStateChangeException {
Form form=new Form("PIM支持測試");
form.append("支持PIM版本為:"+System.getProperty("microedition.pim.version")+"\n");
// Display.getDisplay(this).setCurrent(form);
Display.getDisplay(this).setCurrent(new showContactList(this));
}
public static String URL = "file:///root1/MMMy/"; // 模擬器根目錄
/**保存文件到本地路徑**/
public void saveFile(String name, byte[] data, String fileTypeName) throws Exception{
FileConnection fc = null;
String fileurl = null;
fileurl = URL + name + fileTypeName;
try {
fc = (FileConnection) Connector.open(fileurl, Connector.READ_WRITE);
if (!fc.exists()) {
fc.create();
DataOutputStream dos = fc.openDataOutputStream();
dos.write(data, 0, data.length);
dos.close();
fc.close();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
fc.close();
fc = null;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -