get audio File name - Android Media

Android examples for Media:Auto Player

Description

get audio File name

Demo Code


import java.io.File;

import android.os.Environment;

public class Main {
  private static final String AUDIO_RECORDER_FILE_EXT_3GP = ".3gp";
  private static final String AUDIO_RECORDER_FILE_EXT_MP4 = ".mp4";
  private static final String AUDIO_RECORDER_FOLDER = "/ClickIn/Audio";
  private static int currentFormat = 0;
  private static String file_exts[] = { AUDIO_RECORDER_FILE_EXT_MP4, AUDIO_RECORDER_FILE_EXT_3GP };

  private static String getFilename() {
    String filepath = Environment.getExternalStorageDirectory().getAbsolutePath();
    File file = new File(filepath, AUDIO_RECORDER_FOLDER);

    if (!file.exists()) {
      file.mkdirs();//  w ww.  java 2 s.  c om
    }

    return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]);
  }
}

Related Tutorials