I am facing Error Cannot convert from int to boolean, Here is the code where i am getting this problem.
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;
}
}
Well yes, the problem is here:
while (true)
{
return i;
}
The method is declared to return boolean
, but i
is declared as an int
. That's not going to work. You need to either change the return type to int
, or work out when you want to return true
and when you want to return false
.
Additionally:
i
is always going to be 1while(true)
loop, which is pointlesscatch
block is invalid as far as I'm aware.You've got a pointless if
statement here:
if (localSQLiteDatabase != null);
What are you actually trying to achieve with this code? It looks like it's just badly-decompiled code, to be honest. I suggest you start again from scratch, work out exactly what you're trying to achieve, and proceed from there. Your current code is so confused as to be unhelpful.
See more on this question at Stackoverflow