Skip to content

Tag: android-sqlite

Unable to fetch unread messages from SMS inbox

I have successfully retrieved all messages from inbox but I want only unread messages . I have also apply in the query as read=0 which gives unread SMS but it can’t retrive unread messages it retrieves all messages. Answer Change your query arguments like this You are passing selection where clause for …

Android and SQLite: “nested” getReadableDatabase

In my Android app I use the following code to access db: method1 and method2 can be called independently from outside the class. In addition, there are situations where method1 must call method2. In method2 I need a db instance, so I should call SQLiteDatabase db = helper.getReadableDatabase();. This is ok if…

save text file in sqlite android

I want to save text file in sqlite android but it is giving an error android.database.sqlite.SQLiteConstraintException: NOT NULL constraint failed: at line long result = db.insert(TABLE_NAME,null,cv);. The path gives this in log Download/Link_on.txt and the readFile(path) returns [49, 10, 48, 48, 58, 48&#8230…