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

常用链接

留言簿(6)

我参与的团队

随笔分类(88)

随笔档案(92)

文章分类(142)

文章档案(182)

天基成员

学习园

我的海角

搜索

  •  

积分与排名

  • 积分 - 178730
  • 排名 - 320

最新评论

  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 鹏凌 阅读(339) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: