Logcat shows error in these lines in memorymethod.java
all errors related to getexternalpath()
method which I given below in memorymothod.java code.
StatFs statFs2 = new StatFs(getExternalPath());
public static double getExternalUsedStorage()
{
return Double.parseDouble(getExternalTotalMemory())-Double.parseDouble(getExternalFreeMemory());
}
Here is some code from memorymethod.java
:
public static String getExternalPath()
{
String sSDpath = null;
File fileCur = null;
for( String sPathCur : Arrays.asList("MicroSD", "external_SD", "sdcard1", "ext_card", "external_sd", "ext_sd", "external", "extSdCard", "externalSdCard")) // external sdcard
{
fileCur = new File( "/mnt/", sPathCur);
if( fileCur.isDirectory() && fileCur.canWrite())
{
sSDpath = fileCur.getAbsolutePath();
break;
}
if( sSDpath == null)
{
fileCur = new File( "/storage/", sPathCur);
if( fileCur.isDirectory() && fileCur.canWrite())
{
sSDpath = fileCur.getAbsolutePath();
break;
}
}
if( sSDpath == null)
{
fileCur = new File( "/storage/emulated", sPathCur);
if( fileCur.isDirectory() && fileCur.canWrite())
{
sSDpath = fileCur.getAbsolutePath();
//Log.e("path",sSDpath);
break;
}
}
fileCur = new File( "/storage/extSdCard");
return fileCur.getAbsolutePath();
}