그래서 MediaRecorder로 무언가를 녹음하고 안드로이드 장치 어딘가에 넣으십시오. 그 파일의 이름을 어떻게 바꿉니 까? 이것은 내가 솔루션에있어 가장 가까운 것입니다. 버튼을 클릭하면 아무 일도 일어나지 않습니다.기존 파일의 이름을 바꾸려면 어떻게합니까?
public void nameAlert() {
AlertDialog.Builder nameAlert = new AlertDialog.Builder(this);
nameAlert.setMessage("Name of your recorded file:");
final EditText input = new EditText(this);
nameAlert.setView(input);
nameAlert.setPositiveButton("Enter", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
newFileName = input.getText();
String currentFileName = externalStoragePath;
currentFileName = currentFileName.substring(1);
Log.i(storagePath, currentFileName);
File directory = new File (externalStoragePath);
File from = new File (directory, currentFileName);
File to = new File (directory, newFileName + ".mp3");
from.renameTo(to);
}
});
nameAlert.show();
또한 관련있을 수 있습니다.
externalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
로그 :
08-02 02:04:03.623: I/(14043): storage/emulated/0
귀하의 코드가 꽤 많이하는 것만 큼 간단을 반환하므로 그것은 얻을 수있다. – FabianCook
@SmartLemon 어떤 생각이 잘못 될 수 있습니까? – Pizzret
Wheal onclick 코드? – FabianCook