Tuesday, May 14, 2013

[android help] Creating the folder with password protection


I am trying to create the media recorder for Android by creating the folders with password protection and audio files inside.


But now I only can create the folder and audio files which other Apps and user of the Android smartphone to access.


The purpose of implementing password protection is to not to let other Apps or users can access the file and folders unless password is provided?


Are there any ideas how to achieve this besides creating the password entering panel?


The below is my code.



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;
}
}


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...