private void setRecordingFile() { mFilePath = new File(Tools.getAudioFolderPath(), Const.FilesName.AUDIO_TEMP_FILE_NAME) .getAbsolutePath(); String[] items = mFilePath.split("/"); mFileName = items[items.length - 1]; }
/** * start or stop recording * * @param start true start recording, false stop recording */ private void onRecord(boolean start) { if (start) { onPlay(STOP_PLAYING); mPlayPause.setImageResource(R.drawable.ic_play); startRecordingAsync(); startAnimate(); } else { if (!mIsRecording) { recordingAsync.cancel(true); } stopRecording(); stopAnimating(); try { long size = 0; File forSize = new File(mFilePath); if (forSize.exists()) { size = forSize.length(); String text = getString(R.string.OK) + ", " + Tools.readableFileSize(size); okButton.setText(text); } } catch (Exception e) { e.printStackTrace(); } ; } }