SQLiteDatabase BancoDados = null;
String NomeBanco = "Cadastro";
CriaBanco();
public void CriaBanco(){
try{
BancoDados = openOrCreateDatabase(NomeBanco, MODE_WORLD_READABLE, null);
String SQL = "CREATE TABLE IF NOT EXISTS tabCadastro11 ( _id INTEGER PRIMARY KEY, nome TEXT, imagePath TEXT ) ";
BancoDados.execSQL(SQL);
Criapasta();
MensagemAlerta("Banco de Dados", "Banco Criado com Sucesso");
}catch(Exception erro){
MensagemAlerta("Erro Banco de Dados", "Não foi possivel criar o Banco" + erro);
}
finally {
BancoDados.close();
}
}
public void Criapasta() {
File f = new File("/data/data/com.example.gabrielbonatto.oficial/databases/Cadastro"); //Já tentei o NomeBanco e o BancoDados
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(f);
fos = new FileOutputStream("/mnt/sdcard/meu_banco_dump.db");
while (true) {
int i = fis.read();
if (i != -1) {
fos.write(i);
} else {
break;
}
}
fos.flush();
Toast.makeText(this, "DB dump OK", Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "DB dump ERROR", Toast.LENGTH_LONG).show();
} finally {
try {
fos.close();
fis.close();
} catch (IOException ioe) {
}
}
}
I have read several tutorials where the db file created in an Android application goes, however I only find it using in the Eclipse IDE and not in Android Studio.
Does anyone know where this database file created in the application goes? I would like to know why I wanted to use SQLite Browser to see my database