我正在尝试通过创建带有密码保护和音频文件的文件夹来为 Android 创建媒体记录器。
但是现在我只能创建其他应用程序和Android智能手机用户可以访问的文件夹和音频文件。
实施密码保护的目的是为了不让其他应用程序或用户访问文件和文件夹,除非提供密码?
除了创建密码输入面板之外,还有什么想法可以实现这一点吗?
以下是我的代码。
public void onClick(View view) throws Exception {
    if (count == 0) {
        tbxRecordStatus.setText("Record");
        btnRecord.setText("Stop Record");
        Toast.makeText(MainActivity.this, "Recording Starts",
                Toast.LENGTH_SHORT).show();
        String dateInString =  new SimpleDateFormat(
                "yyyy-MM-dd-HH-mm-ss").format(new Date()).toString();
        String fileName = "TasB_" + dateInString + " record.3gp";
        SDCardpath = Environment.getExternalStorageDirectory();
        myDataPath = new File(SDCardpath.getAbsolutePath()  + "/My Recordings");
        if (!myDataPath.exists())
            myDataPath.mkdir();
        audiofile = new File(myDataPath + "/" + fileName);
        recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        recorder.setAudioEncodingBitRate(16);
        recorder.setAudioSamplingRate(44100);
        recorder.setOutputFile(audiofile.getAbsolutePath());
        try
        {
         recorder.prepare();
        }
        catch (Exception e) 
        {
            e.printStackTrace();
        }
        recorder.start();
        count++;
    } else {
        tbxRecordStatus.setText("Stop");
        btnRecord.setText("Start Record");
        Toast.makeText(MainActivity.this, "Recording Stops",
                Toast.LENGTH_SHORT).show();
        if (recorder != null) {
            recorder.stop();
            recorder.release();
            recorder = null;
        } else {
            tbxRecordStatus.setText("Warning!");
            Toast.makeText(MainActivity.this, "Record First",
                    Toast.LENGTH_SHORT).show();
        }
        count = 0;
    }
}