-1
This line of code gives me error in sentence SQLiteDatabase.CREATE_IF_NECESSARY
and stops me from making the database. Because this is happening?
SQLiteDatabase BaseDados=SQLiteDatabase.openOrCreateDatabase("BaseDados",SQLiteDatabase.CREATE_IF_NECESSARY,null);
The mistake is this:
Error:(16, 54) error: no suitable method found for openOrCreateDatabase(String,int,) method Sqlitedatabase.openOrCreateDatabase(String,Cursorfactory,Databaseerrorhandler) is not applicable (actual argument int cannot be converted to Cursorfactory by method Invocation Conversion) method Sqlitedatabase.openOrCreateDatabase(String,Cursorfactory) is not applicable (current and formal argument lists differ in length) method Sqlitedatabase.openOrCreateDatabase(File,Cursorfactory) is not applicable (current and formal argument lists differ in length)
The code I made is this::
public class GestorBaseDados {
Context contexto;
SQLiteDatabase BD;
public GestorBaseDados(Context cont) {
contexto=cont;
String erro=null;
try {
BD=SQLiteDatabase.openOrCreateDatabase("BaseDados",SQLiteDatabase.CREATE_IF_NECESSARY,null);
}catch (Exception e)
{
Toast.makeText(contexto,"erro "+e.toString(),Toast.LENGTH_LONG).show();
}
}
}
This is a class that will have all the methods to mess with the database.
Puts the error that occurred
– adelmo00
And what error does it make? Without the error message becomes more difficult.
– Bacco
Was this : Error:(16, 54) error: no suitable method found for openOrCreateDatabase(String,int,<null>) method Sqlitedatabase.openOrCreateDatabase(String,Cursorfactory,Databaseerrorhandler) is not applicable (actual argument int cannot be converted to Cursorfactory by method Invocation Conversion) method Sqlitedatabase.openOrCreateDatabase(String,Cursorfactory) is not applicable (actual and formal argument lists differ in length) method Sqlitedatabase.openOrCreateDatabase(File,Cursorfactory) is not applicable (actual and formal argument lists differ in length)
– kingwarrior05
won’t even let me compile, the project
– kingwarrior05