title: SQLite database disappeared from Android emulator
body: <p>I'm working in Android Studio 3.0.1 and using Android emulator to see how application run. I had SQLite database for my application but after update of Android Studio or maybe its components emulator started with message &quot;performing clean boot snapshot doesn't exist&quot;. My database disappeared from application. Is that some wipe on Android emulator or I've made some mistake in database programming? Can this trouble happens on real device?</p>
  <pre><code>import android.content.ContentValues
  import android.content.Context
  import android.database.Cursor
  import android.database.sqlite.SQLiteDatabase
  import android.database.sqlite.SQLiteOpenHelper
  import android.database.sqlite.SQLiteQueryBuilder
  import android.widget.Toast
  import android.database.SQLException
  import kotlin.collections.ArrayList
  
  
  class DbManagerVol {
      var dbName=Const.DB_NAME
      var dbTable:String? = null
      val dbVersion = 2
      var sqlCreateTable:String? = null 
      var sqlDB:SQLiteDatabase? = null
  
      constructor (context: Context, dbTable:String?, sqlCreateTable:String?) {
          this.sqlCreateTable = sqlCreateTable
          this.dbTable = dbTable
          val db = DataBaseHelperVol(context)
          sqlDB=db.writableDatabase
          if(sqlCreateTable!=null)sqlDB!!.execSQL(sqlCreateTable)
      }
  
      inner class DataBaseHelperVol:SQLiteOpenHelper {
          var context:Context?=null
          constructor(context: Context):super(context,dbName,null,dbVersion){
              this.context=context
          }
          override fun onCreate(db: SQLiteDatabase?) {
  
              db!!.execSQL(sqlCreateTable)
              Toast.makeText(this.context, &quot;database $dbName is created&quot;, Toast.LENGTH_LONG).show()
          }
  
          override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
              db!!.execSQL(&quot;Drop table IF EXISTS $dbTable&quot;)
          }
  
      }
      fun dbInsert(values:ContentValues):Long{
          val ID = sqlDB!!.insert(dbTable, &quot;&quot;, values)
          return ID
      }
  
      fun dbQuery(projection: Array&lt;String&gt;, selection:String, selectionArgs:Array&lt;String&gt;, sortOrder:String):Cursor?{
          val qb = SQLiteQueryBuilder()
          qb.tables=dbTable
          var cursor:Cursor? = null
          try {
              cursor = qb.query(sqlDB, projection, selection, selectionArgs, null, null, sortOrder)
          }catch (e:Exception){}
          return cursor!!
      }
  
      fun dbQueryArray(projection: Array&lt;String&gt;, selection:String, selectionArgs:Array&lt;String&gt;, sortOrder:String,
                        spUndefined:String, spAdd:String, spDelete:String):ArrayList&lt;String&gt;{
          val listSpinner:ArrayList&lt;String&gt;? = ArrayList&lt;String&gt;()
          val qb = SQLiteQueryBuilder()
          qb.tables=dbTable
  
          try {
              val cursor:Cursor? = qb.query(sqlDB, projection, selection, selectionArgs, null, null, sortOrder)
              if (cursor!!.moveToFirst()) {
                  do {
                      val str = cursor.getString(cursor.getColumnIndex(sortOrder))
                      listSpinner!!.add(str)
  
                  } while (cursor.moveToNext())
              }
              listSpinner!!.add(spUndefined)
              listSpinner.add(spAdd)
              listSpinner.add(spDelete)
  
          } catch (e:SQLException) {
              listSpinner!!.add(spUndefined)
              listSpinner.add(spAdd)
              listSpinner.add(spDelete)
          }
  
          return listSpinner!!
      }
      
      fun dbRowDelete(colName:String, value:String):Int {
          sqlDB!!.execSQL(sqlCreateTable)
          val str2 = &quot;$colName='$value'&quot;
          return sqlDB!!.delete(dbTable, str2, null)
      }
      
      fun dbLastRowInt(dbTable:String, column:String):Int {
          val selectQuery= &quot;SELECT * FROM $dbTable ORDER BY $column DESC LIMIT 1&quot;
          val cursor = sqlDB!!.rawQuery(selectQuery, null)
          var a = 0
          if(cursor.moveToFirst())
              a  =  cursor.getInt( cursor.getColumnIndex(column) )
          cursor.close()
          return a
  
  
      }
      
      fun dbUpdateRow (table:String, values: ContentValues, colName:String, value:Int):Int {
          return sqlDB!!.update(table, values, &quot;$colName = $value&quot;, null)
      }
  
      fun dbDelTable () {
          sqlDB!!.execSQL(&quot;Drop table IF EXISTS $dbTable&quot;)
      }
  
      fun dbRowsDelete(colName:String, values:Array&lt;String&gt;):Int {
          sqlDB!!.execSQL(sqlCreateTable)
          val placeholders = StringBuilder()
          for (i in 0 until values.size) {
              if (i != 0)
                  placeholders.append(&quot;, &quot;)
  
              placeholders.append(&quot;?&quot;)
          }
  
          val where = &quot;$colName IN (&quot; + placeholders.toString() + &quot;)&quot;
          return sqlDB!!.delete(dbTable, where, values)
      }
  
      fun countTables () :ArrayList&lt;String&gt;{
          val array = ArrayList&lt;String&gt;()
          val c = sqlDB!!.rawQuery(&quot;SELECT name FROM sqlite_master WHERE type='table'&quot;, null) 
          if (c.moveToFirst()) {
              while ( !c.isAfterLast) {
                  array.add( c.getString( c.getColumnIndex(&quot;name&quot;)) )
                  c.moveToNext()
              }
          }
          return array
      }
  
  }
    
  </code></pre>