我面临错误无法从int转换为布尔值,这里是我得到这个问题的代码。错误无法从int转换为布尔值
private boolean seeDB()
{
int i = 1;
SQLiteDatabase localSQLiteDatabase = null;
try
{
localSQLiteDatabase = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, 1);
localSQLiteDatabase = localSQLiteDatabase;
label01:
if (localSQLiteDatabase != null)
localSQLiteDatabase.close();
if (localSQLiteDatabase != null);
while (true)
{
return i;
}
}
catch (SQLiteException localSQLiteException)
{
break label01;
}
}
您已声明此方法返回一个布尔值。但是你正在返回你已经声明为int的'i'。 –
你正在返回一个'int'。你应该返回一个'boolean'。将返回类型从'boolean'更改为'int'或者调整您的逻辑。 (从循环中判断只运行一次,随机标签表达式 - 我认为后者会是一种更强的方法。) – Makoto
您可以根据i的值将返回类型更改为int(或)返回布尔值(true或false) – upog