录音机的Widget犯规停止录制 [英] Sound Recorder Widget doesnt stop recording

查看:115
本文介绍了录音机的Widget犯规停止录制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用涉及大量的录音,所以我做了一个小部件可以从主屏幕录制。 我有一类Recorder.java,我处理所有的MediaRecorder电话。 从活动的录音时,一切工作正常。从部件录制时,它会记录,但不停止录制时,它应该。

My application involves plenty of sound recording, so I made a widget to be able to record from the Home screen. I have a class Recorder.java where I deal with all the MediaRecorder calls. When recording from the activity, everything works fine. When recording from widget, it records, but doesn't stop recording when it should.

下面是code我用它来停止该活动:

Here is the code I use to stop from the activity:

//r is an instance of Recorder.java
if (r.getState() == Recorder.RECORDING) {
                r.stopRecording();

            }

当在插件的录制按钮pssed $ P $,它启动一个服务,即检查记录的状态。如果r被记录,然后停止,如果是不那么它开始记录。此检查工作,因为当它记录和我preSS它,我得到应该出现的的敬酒后的它停止录制,但它从来没有停止录音。 在服务我也使用 r.sto precording();

When the recording button in the widget is pressed, it starts a service, that checks the recorder state. If r is recording then it stops, if it isn't then it starts recording. This checks works because when its recording and I press it I get a Toast that should appear after it stopped recording, but it never stops recording. On the service I also use r.stopRecording();

任何想法可能是错误的,我code?

Any ideas what might be wrong in my code?

推荐答案

请尝试使用 prepare()停止() 叫,最后版本更新()的 MediaRecorder 对象

please Try to use prepare() after Stop() called and at last relase() the MediaRecorder Object

这篇关于录音机的Widget犯规停止录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆