Tag: sqlite

Sqlite Select Query with rawQuery at Android

I know it is a basic question, but i can not find problem. I try to get some columns with rawQuery. SQLiteDatabase db=database.getReadableDatabase(); try { String sql=”SELECT * FROM CAR WHERE name = “; Cursor crs = db.rawQuery(sql+”5P”, null); } I always get the same exception. android.database.sqlite.SQLiteException: **unrecognized token**: “5P”: , while compiling: SELECT * […]

SQLite – Is it possible to insert a BLOB via insert statement?

I’m developing an Android application and i’m using a Sqlite database to store some bitmaps. I want some images to be automatically inserted when the user installs the application. I’m using the SQLiteOpenHelper class like this: public class DatabaseHelper extends SQLiteOpenHelper { … DatabaseHelper(Context context, String nameOfDB, int version, String[] scriptSQLCreate, String scriptSQLDelete) { super(context, […]

Get SQLite database from Android app

I need get SQLite database from Android app from Genesis device where user has populated by hand. How I can create another app or any other way to get this db and save in place where I can get? obs.: the device has root Thanks

How can you access the contents of Android Emulator databases?

I’ve read the answer to a question as to how to access the contents of the databases, however I cannot seem to get it to work on my machine. Here is the shell log: C:\android-sdk-windows\tools>adb -s emulator-5554 shell # sqlite3 /data/data/com.android.demo.notepad2/databases/notes sqlite3 /data/data/com.android.demo.notepad2/databases/notes SQLite version 3.5.9 Enter “.help” for instructions sqlite> .tables .tables sqlite> ^C […]

What happens to a Sqlite database when app is removed

I’m new to Android programming and trying to wrap my head around this just to make myself clear about how things work. When creating Sqlite databases in an Android app, where is the database stored? Does it get deleted when the app is removed? Any info about this would be much helpful in understanding Android […]

Android SQLite Delete row issue

I am trying to delete a row from a table but i have three WHERE clauses and i am not sure if i am using the correct statement. db.delete(DBAdapter.TableName, “Id=”+ Id +” AND WHERE QstnrId = “+Integer.parseInt(QuestionnaireId) +” AND WHERE QstnId = “+Integer.parseInt(QuestionId), null); I am almost certain i am not using the statement correctly. […]

java.lang.IllegalStateException: attempt to re-open an already-closed object(Tried closing )

public int getRecordsCount() { String countQuery = “SELECT * FROM ” + TABLE_LOGIN; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); if(cursor != null && !cursor.isClosed()){ cursor.close(); } // return count return cursor.getCount(); } I am trying to get the totalnumber of records in the database, but the database is getting crashed everytime with […]

SQLite exception: Database is locked issue

I’m having an issue with my SQLite database inside an Android app. It seems to happen every so often and I cannot reproduce it, but this is the report the Android Market gives. Basically I have first a splash screen activity that starts by checking if all the needed data is in the database. If […]

Android – Storing sensitive data in the sqlite database

I need to store sensitive data in a sqlite database in an android app. How can I be sure this data is very safe? I know I can encrypt the data using a key, but where do I store that key? I don’t want to ask the user to fill in a key either, I […]

Random() in sqlite and Android sdk

I want to extract random rows from the app sqlite database in Android. I’m aware that, with sqlite, you can select random rows with: SELECT * FROM table ORDER BY RANDOM() LIMIT 1; In the app, I have something like this return mDb.query(TABLE, new String[] {“col1”, “col2”}, null, null, null, null, “Random()”, “2”); this is […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.