Tag: sqlite

Application did not close the cursor or database object that was opened here :

My code is : public class EventDataSQLHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = “my.db”; } public class Test extends Activity { EventDataSQLHelper eventsData; @Override protected void onDestroy() { System.out.println(“onDestroy”); close(); if (db!=null){ db.close(); } super.onDestroy(); } public void close() { eventsData.close(); } I have closed the db here.. In all my activities […]

Android SQLIte error: Couldn't read row 0, col 1 from CursorWindow

I am using a prepopulated slqite database that I created using sqlitebrowser. I have placed the database file (it doesnt seem to have an extension) into my assets folder. I’m using the standard databasehelper class that everyone seems to be using. 05-09 13:04:55.746 894-894/com.myapp.myappname E/CursorWindow´╣Ľ Failed to read row 0, column 1 from a CursorWindow […]

Android ExpandableListActivity and SimpleCursorTreeAdapter?

I’m writing a simple application for Android. I have 2 tables – one called ‘grous’ and another called ‘group_items’. I want to use expandable list to display data from both tables. What is the best way to do it? Is it possible to map data by using SimpleCursorTreeAdapter? I couldn’t find any usefull examples. I […]

Is using Android shared preferences for storing large amounts of data a good idea?

So I inherited this Android project from someone else. The code currently seems to be storing huge amounts of data (that should really belong to an SQLite database) into the shared preferences. I’m very uncomfortable with that part of the code and want to start using the sqlite database. But I am still unable to […]

Getting SQLite database by adb shell in cmd

Very simple question but confusing . i am using sqlite in my android app. i want to know we can perform (create ,insert,update,delete) operation in sqlite by command prompt:- path> adb shell shell@android:/ $ sqlite3 /data/data/pack/databases/name sqlite> operations….. this all success with my emulator. but i did same thing after attaching my google nexus device. […]

Resetting Autoincrement in Android SQLite

I have this method which will remove all rows from a table but i also want it to reset the autoincrement so that when a new row is added it will start again. The SQL statement i’m using isnt working due to certain columns not existing. Am i doing it right? private void rmvall() { […]

Using SQLite Trigger to update “LastModified” field

This might be more of a design question, but here goes. I’m writing an Android app that uses a local SQLite database (with multiple tables) that syncs with a MySQL database every now-and-then. I only want to update modified rows in my database. To do this, I’m adding a column “last_modified” to each row that […]

SQLite Database “context” passed to adapter

I have followed this tutorial to use SQLite db in my android app. Since I am a beginner I’m having problems understanding “context” parameter used in the example. I want to call adapter and insert/update/delete records from a class that does not extend activity wich in this example stands for context. Now I don’t know […]

Android SQLite rawquery parameters

How can i pass intger to a rawquery in sqlite for android. Here its not taking g and s into query. Please guide. int g, s; Cursor cur3 = database2.rawQuery(“select max(UnixTimeStamp) from Quote where EmoticonID=%d and SubCategoryID=%d” ,new String [] {g,s});

Getting the next AUTO_INCREMENT value of a SQLite database

Using the typical SQLiteDatabase object in Android’s API, what can I do to get the next AUTO_INCREMENT value of a particular column (ie. id) without affecting the value itself. Is there a method for that? Or what query should I execute to get that result. Keep in mind that SQLiteDatabase.query() returns a Cursor object, so […]

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