Java tutorial
//package com.java2s; //License from project: Apache License import android.os.Environment; import java.io.File; import java.util.UUID; public class Main { public static final String VOICE_PATH = Environment.getExternalStorageDirectory().getPath() + "/cat_voice"; public static String createVoiceFile() { return createFile(VOICE_PATH, UUID.randomUUID() + ".amr"); } public static String createFile(String parent, String fileName) { File dir = new File(parent); if (!dir.exists()) { dir.mkdirs(); } File file = new File(dir, fileName); return file.getAbsolutePath(); } }