我正在尝试通过用户输入来保存音频文件名,但是当我使用名称(test1)保存文件编号1时,什么也不会保存;当我使用名称(test2)再次尝试保存音频文件名时,第二个文件使用第一个名字保存( test1),第二个第三名(test2)
private Button play, stop, record;
private MediaRecorder myAudioRecorder;
private String outputFile = "";
final String format = ".3gp";
private String inputText = "";
//make dir
boolean exists = (new File("/storage/emulated/0/PonezRecorder/")).exists();
if (!exists){new File("/storage/emulated/0/PonezRecorder").mkdirs();}
//user input name
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
outputFile = input.getText().toString();
// Record button click listener
record.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder = new MediaRecorder();
myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
myAudioRecorder.setOutputFile("/storage/emulated/0/PonezRecorder/"+ outputFile + format );
try {
myAudioRecorder.prepare();
myAudioRecorder.start();
} catch (IllegalStateException ise) {
// make something ...
} catch (IOException ioe) {
// make something
}
// stop click listener
stop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myAudioRecorder.stop();
myAudioRecorder.release();
myAudioRecorder = null;
答案 0 :(得分:0)
请尝试这个;
function googleSignOut() {
if (typeof module_google_login == 'undefined') {
return false;
}
gapi.load('auth2', function () {
gapi.auth2.init().then(function () {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
$.ajax({
type: 'POST',
url: '/account/logout/',
success: function () {
window.location = "/account";
}
});
});
});
});
};