日期:2014-05-20  浏览次数:20820 次

模拟器 可以实现手机录音吗 帮忙看看程序 没有录音文件生成
程序执行完成   root1目录下没有文件生成   不知道为什么啊   请指教啊

import   javax.microedition.midlet.*;  
import   javax.microedition.media.*;  
import   javax.microedition.media.control.*;  
import   javax.microedition.lcdui.*;  
import   java.io.*;  


public   class   ssss   extends   MIDlet   {

public   ssss()   {
//   TODO   Auto-generated   constructor   stub
try   {
        //   Create   a   DataSource   that   captures   live   audio.
        Player   p   =   Manager.createPlayer( "capture://audio ");
        System.out.println( "1 ");  
        p.realize();
        System.out.println( "2 ");  
        //   Get   the   RecordControl,   set   the   record   location,   and  
        //   start   the   Player   and   record   for   5   seconds.
        RecordControl   rc   =   (RecordControl)p.getControl( "RecordControl ");
        System.out.println( "3 ");  
        rc.setRecordLocation( "file://C:/root1/audio.wav ");
        System.out.println( "4 ");  
        rc.startRecord();
        System.out.println( "5 ");  
        p.start();
        System.out.println( "6 ");  
        Thread.currentThread().sleep(5000);
        System.out.println( "7 ");  
        p.stop();
        System.out.println( "8 ");  
        rc.stopRecord();
        System.out.println( "9 ");  
        rc.commit();
}   catch   (IOException   ioe)   {
}   catch   (MediaException   me)   {
}   catch   (InterruptedException   e)   {   }

}

protected   void   destroyApp(boolean   arg0)   throws   MIDletStateChangeException   {
//   TODO   Auto-generated   method   stub

}

protected   void   pauseApp()   {
//   TODO   Auto-generated   method   stub

}

protected   void   startApp()   throws   MIDletStateChangeException   {
//   TODO   Auto-generated   method   stub

}

}


------解决方案--------------------
多看看API吧
------解决方案--------------------
这都什么代码啊?乱七八糟的
rc.setRecordLocation( "file://C:/root1/audio.wav ");
随便看了下,这个路径错了,在模拟器上应该是file:///root1/audio.wav
试试行不行在说吧