Reputation: 1109
Hi i'm trying to create an if statement that checks the size of a file here's what i have although it's not working.
File file = new File("/path/to/file.zip");
long fileSize = file.length();
if (!(fileSize > 0));{
Toast.makeText(MainMethod.this, "Equal to 0", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainMethod.this, "Greater than 0", Toast.LENGTH_LONG).show();
}
Upvotes: 0
Views: 13089
Reputation: 77
There is a semicolon at the end of your if statement. Also, you can simplify the code somewhat by doing the following:
if (file.length() > 0)
System.out.println("File Greater than 0");
else
System.out.println("File LessThanEqual to 0");
Just my opinion
Upvotes: 3
Reputation: 23208
You have a semicolon at the end of your IF statement which is causing the problem here.
Upvotes: 13