I know this seems like a stupid question, but it is driving me nuts.
I am trying to display the value of folder_size
in my toast, but I get the error:
The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (Context, long, int)
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/X ADB/");
long folder_size = getFolderSize(file);
Toast.makeText(getApplicationContext(),folder_size, Toast.LENGTH_LONG).show();
}
public static long getFolderSize(File dir) {
long size = 0;
for (File file : dir.listFiles()) {
if (file.isFile()) {
// System.out.println(file.getName() + " " + file.length());
size += file.length();
} else
size += getFolderSize(file);
}
return size;
}
}
This is the solution I have found, but I need to add an additional text in my toast, which I don't want. How do I remove this error?
Toast.makeText(getApplicationContext(),folder_size+ " text", Toast.LENGTH_LONG).show();