public boolean tabIsExist(SQLiteDatabase db){ boolean result = false; if(yourTableName == null){ return false; } Cursor cursor = null; try { String sql = "select count(*) as c from sqlite_master where type ='table' and name ='"+yourTableName.trim()+"' "; cursor = db.rawQuery(sql, null); if(cursor.moveToNext()){ int count = cursor.getInt(0); if(count>0){ result = true; } } } catch (Exception e) { } return result; }
Android development to determine whether a table exists in the SQLite database
Directly on the method:
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327070009&siteId=291194637
Recommended
Ranking