Tag: sqlite

SQLite Android . unable to open database file

I found a lot of question about this problem, but i can’t fix it. I have a sqlite db in assets folder: assets/data/data/{package_name}/databases/mydb.db I can open database and read data before change one table structure. I try to uninstall the app and reinstall again, but i get the same exception. What can i do now? […]

How to use SQLite DB from AsyncTask?

I’ve been using my Activity class to access my DB which made my program freeze sometimes. So I decided to use AsyncTask instead to handle the DB. My problem is I don’t know how to instantiate my SQLite DB “TheDB” from AsyncTask’s class public class myClass extends AsyncTask<Void, Void, Void>{ private TheDB db; any method() […]

Do i have to use _ID as a SQlite primary key? and does it have to be an INT? (Android Dev)

This is probably a silly question but i haven’t been able to find the answer yet. I want to use a TEXT column with my own unique names as the primary key in a table. the little section of code to define this looks something like this in my project: …blahblah…”CREATE TABLE ” + CAT_BUD_TAB […]

Ormlite Android bulk inserts

can anyone explain why my inserts are taking so long in Ormlite? Doing 1,700 inserts in one sqlite transaction on the desktop takes less than a second. However, when using Ormlite for Android, it’s taking about 70 seconds, and I can see each insert in the debugging messages. When I try and wrap the inserts […]

Android: column '_id' does not exist

I am getting this error IllegalArgumentException: column ‘_id’ does not exist When using a SimpleCursorAdapter to retrieve from my database, and the table does indeed have this _id column. Noticing this a common problem, I have tried to work around it given some of the solutions online but none of them work. This is my […]

Android SQLite query where column is not null and not empty

I cannot figure out the syntax for the .query call. I need to select all records that match a certain column that do not have a null or empty value for a second (different) column my best attempt: Cursor cursor = mDatabase.query(DatabaseOpenHelper.TABLE_ROOMS, mAllColumns, DatabaseOpenHelper.KEY_ROOM_HOSPITAL_ID + ” =? AND ” + DatabaseOpenHelper.KEY_ISO + ” IS NOT […]

Is it possible to obtain read-only access to an sqlite database in an apk?

Possible Duplicate: How to put existing database in the .apk file? Is it possible to obtain read-only access to an sqlite database located with an apk? I don’t want to duplicate the database if it is possible to access it for read-only purposes from within the apk.

ActiveAndroid Many-to-many relationship

I’m currently using ActiveAndroid, and have been trying to get a many-to-many relationship to work for the past few hours, however I just can’t get it to work. I hope you can help me out: I have the models “Student” and “Course”, a student can have many courses, and a course has many students. Basically […]

SQLite table with integer column stores string

I found something weired in my application. I created a table with a column named type which should store integers: db.execSQL(“CREATE TABLE ” + CellColumns.TABLE + ” (” + CellColumns._ID + ” INTEGER PRIMARY KEY,” + CellColumns.TYPE + ” INTEGER,” // <– this + CellColumns.CELL_ID + ” INTEGER,” + CellColumns.CITY_ID + ” INTEGER,” + CellColumns.LOAD […]

ormlite read Date as 'yyyy-MM-dd'

I need to read a sqlite databse given to me, so I cannot change the Date format (yyyy-MM-dd) in the tables. When I try to use ormlite to generate object for me, using the following annotation: @DatabaseField(columnName = “REVISION_DATE”, dataType = DataType.DATE_STRING) public Date revisionDate; it gives me the following error: java.sql.SQLException: Problems with column […]

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