Maybe this is a “simple” question but I have this method:
public int getMaxColumnData() {
bdd = maBaseSQLite.getWritableDatabase();
final SQLiteStatement stmt = bdd
.compileStatement("SELECT MAX(column) FROM Table");
return (int) stmt.simpleQueryForLong();
}
and I would like to do this int i = getMaxColumnData();
And that throws an error.
My goal is to find the maximum of a column in the database table.
Here is the error:
Cannot make a static reference to the non-static method getMaxColumnData() from the type CapteursBDD
EDIT: the problem is probably because
bddis declared asstaticwhereas the method in which you usebddis not static.Changing the method signature to
public static int getMaxColumnData()might solve your problem.