隨筆 - 64  文章 - 9  trackbacks - 0
          <2010年3月>
          28123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          常用鏈接

          留言簿(6)

          我參與的團隊

          隨筆分類(88)

          隨筆檔案(92)

          文章分類(142)

          文章檔案(182)

          天基成員

          學習園

          我的海角

          搜索

          •  

          積分與排名

          • 積分 - 183403
          • 排名 - 319

          最新評論

          1. package lab.sodino.filesys;  
          2. import javax.microedition.io.file.FileSystemListener;  
          3. import javax.microedition.io.file.FileSystemRegistry;  
          4. import javax.microedition.lcdui.Alert;  
          5. import javax.microedition.lcdui.AlertType;  
          6. import javax.microedition.lcdui.Display;  
          7. import javax.microedition.lcdui.Form;  
          8. import javax.microedition.midlet.MIDlet;  
          9. import javax.microedition.midlet.MIDletStateChangeException;  
          10. public class FSListenerDemo extends MIDlet implements FileSystemListener {  
          11.     public FSListenerDemo() {  
          12.         super();  
          13.         Form f = new Form("FSDemo");  
          14.         Display.getDisplay(this).setCurrent(f);  
          15.     }  
          16.     protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {  
          17.     }  
          18.     protected void pauseApp() {  
          19.     }  
          20.     protected void startApp() throws MIDletStateChangeException {  
          21.         FileSystemRegistry.addFileSystemListener(this);  
          22.     }  
          23.     public void rootChanged(int state, String rootName) {  
          24.         if (state == FileSystemListener.ROOT_ADDED) {  
          25.             Alert alert = new Alert("Information""A new card has been mounted, it's name is " + rootName, null,  
          26.                     AlertType.CONFIRMATION);  
          27.             alert.setTimeout(Alert.FOREVER);  
          28.             Display.getDisplay(this).setCurrent(alert);  
          29.         } else if (state == FileSystemListener.ROOT_REMOVED) {  
          30.             Alert alert = new Alert("Information""A new card has been unmounted, it's name is " + rootName, null,  
          31.                     AlertType.CONFIRMATION);  
          32.             alert.setTimeout(Alert.FOREVER);  
          33.             Display.getDisplay(this).setCurrent(alert);  
          34.         }  
          35.     }  
          36. }  
          posted on 2010-03-19 23:05 鵬凌 閱讀(351) 評論(0)  編輯  收藏 所屬分類: java
          主站蜘蛛池模板: 绥宁县| 卢龙县| 克拉玛依市| 翼城县| 措美县| 庄浪县| 常山县| 罗平县| 商都县| 大关县| 勐海县| 宣化县| 黑河市| 霸州市| 山阴县| 万安县| 洮南市| 林口县| 黑河市| 白水县| 宁海县| 徐汇区| 永川市| 南陵县| 璧山县| 应用必备| 威远县| 河北区| 修水县| 巴塘县| 石林| 铅山县| 鹿邑县| 黄陵县| 托克逊县| 珠海市| 阿图什市| 昭苏县| 阳泉市| 五峰| 阳高县|