private File getTempFile(Context context, String fileName) {
        File file = null;
        try {
            fileName = fileName.replaceAll("\\W+", ""); // remove all special chars to get a valid filename
            file = File.createTempFile(fileName, null, context.getCacheDir());
        } catch (IOException e) {
            // Error while creating file
        }
        return file;
    }
http://developer.android.com/training/basics/data-storage/files.html
MediaPlayer-DASH/src/main/java/net/protyposis/android/mediaplayer/dash/DashMediaExtractor.java