Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Environment;

import java.io.File;

public class Main {
    /**
     * Takes care of creating a directory for our application on the device's storage and
     * then returns the full path to it
     * @return The full path to the directory where our sound files will be stored
     */
    private static String getDirectoryPath() {
        // Replace the path here with your own
        File file = new File(Environment.getExternalStorageDirectory(), "/GenericAndroidSoundboard/Audio/");
        // Create the directory if it doesn't exist
        if (!file.exists()) {
            file.mkdirs();
        }

        // Get the path to the newly created directory
        return Environment.getExternalStorageDirectory().getAbsolutePath() + "/GenericAndroidSoundboard/Audio/";
    }
}