Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File file = new File(Constants.ROOT_PATH);
- int i = 0;
- while (!file.isDirectory() && !file.mkdirs()) {
- file.mkdirs();
- Log.e("mkdirs", "" + i++);
- }
- String root = Environment.getExternalStorageDirectory().toString();
- File myDir = new File(root + "/hello_world");
- myDir.mkdirs();
- File file = new File (myDir, file_name);
- if (file.exists ())
- // file exist
- else
- // file not exist
- if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
- {
- if (DEBUG) {Log.d(TAG, "createSoundDir: media mounted");} //$NON-NLS-1$
- File externalStorage = Environment.getExternalStorageDirectory();
- if (externalStorage != null)
- {
- String externalStoragePath = externalStorage.getAbsolutePath();
- File soundPathDir = new File(externalStoragePath + File.separator + "Hello_World"); //$NON-NLS-1$
- if (soundPathDir.isDirectory() || soundPathDir.mkdirs())
- {
- String soundPath = soundPathDir.getAbsolutePath() + File.separator;
- if (DEBUG) {Log.d(TAG, "soundPath = " + soundPath);} //$NON-NLS-1$
- }
- }
- }
- public static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Hello_World/";
- File file = new File(Constants.ROOT_PATH);
- int i = 0;
- if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
- if(!file.exists()) {
- file.mkdir();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement