moved XML submodule to resources
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package com.example.aped.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
/**
|
||||
* Utility for getting information related to the external storage.
|
||||
*/
|
||||
public final class ExternalStorageHandler {
|
||||
|
||||
private ExternalStorageHandler() { }
|
||||
|
||||
/**
|
||||
* Checks whether the external storage is mounted.
|
||||
* @return boolean value
|
||||
*/
|
||||
public static boolean isExternalStorageMounted() {
|
||||
return Environment.MEDIA_MOUNTED.equals(
|
||||
Environment.getExternalStorageState()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the external storage is read only.
|
||||
* @return boolean value
|
||||
*/
|
||||
public static boolean isExternalStorageReadOnly() {
|
||||
return Environment.MEDIA_MOUNTED_READ_ONLY.equals(
|
||||
Environment.getExternalStorageState()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the external private storage base directory path for an activity.
|
||||
* @param context the relevant activity
|
||||
* @return the path to the base of the external private storage
|
||||
* @throws FileNotFoundException checks if the directory is mounted
|
||||
*/
|
||||
public static String getExternalPrivateStorageDir(final Context context)
|
||||
throws FileNotFoundException {
|
||||
if (isExternalStorageMounted()) {
|
||||
File file = context.getExternalCacheDir();
|
||||
return file.getAbsolutePath();
|
||||
} else {
|
||||
throw new FileNotFoundException(
|
||||
"The relevant storage is not available."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Submodule APED/app/src/main/java/com/example/aped/xml deleted from 3600828925
1
APED/app/src/main/res/raw/XML
Submodule
1
APED/app/src/main/res/raw/XML
Submodule
Submodule APED/app/src/main/res/raw/XML added at ce8ce41609
Reference in New Issue
Block a user