我已经写了这段代码来录制电话.它在Android 2.1中运行良好.在Android 2.2中,它创建一个0字节的输出文件.
我怎么能解决这个问题?
MediaRecorder _recorder = new MediaRecorder();
public void start() throws IOException {
try {
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted. It is " + state
+ ".");
}
// make sure the directory we plan to store the recording in exists
File directory = new File(Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/sam.wav").getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created.");
}
_recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL );
_recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath()
+ …
Run Code Online (Sandbox Code Playgroud) 我想将log cat的所有内容保存到Android中的特定文件中.我使用Eclipse IDE开发android应用程序.
我怎么能做到这一点?
谢谢.
我想发送和接收以上数据音频频道中的Android,黑莓和J2ME.
可能吗 ?如果是,那么我如何实现它?
谢谢
我想复制一个特定的文件(S)到模拟器中的Android.怎么可能?
谢谢.
我使用XML文件在Android中创建子菜单.但我想用编程代码创建它.
是否有可能创造?
我怎么能实现它?
谢谢.
我想在Android的应用程序管理器中隐藏我的应用程序.
可能吗 ?
我怎么能做到这一点?
谢谢.
我想创建一个应用程序,如果它被用户卸载,那么我想停止卸载Application.
我怎么能这样做?
谢谢