Tag: sqlite

SQLiteDatabase.openDatabase vs SQLiteOpenHelper.getReadableDatabase

Is there any difference between these two methods? Both return an opened SQLiteDatabase. Both can create a database if one doesn’t exist. SQLiteOpenHelper also has getWriteableDatabase when read/write is needed… Which method should I use and where? Based on sample code I’ve seen, I’m using SQLiteOpenHelper to create my database in the first place, but […]

Android: Filtering a SimpleCursorAdapter ListView

Right now, I’m running into issues trying to implement a FilterQueryProvider in my custom SimpleCursorAdapter, since I’m unsure of what to do in the FilterQueryProvider’s runQuery function. In other words, since the query that comprises my ListView basically gets the rowID, name, and a third column from my databases’s table, I want to be able […]

Storing file in Android Database (Custom Content Provider) using _data field – v1.6

I have been battling with an issue in my Android app. I have been reading Android docs, my book on Android (Andriod Pro 2) and have looked at almost each and every example I could get my hands on but could not figure out how to implement storing of files (images, binary data) against records […]

Sharing and persisting data between multiple Android applications

I’m developing a group of complex Android applications that need to share common state and configuration settings. For example, see this picture explaining my scenario: I want that APP 1, APP 2 and APP 3 be able to access (read/write) data to the common storage area. Additionally, I need uninstall protection i.e. I don’t want […]

Android Rating Bar shows only full stars, not half stars too

I’m using rating bars in my Android application. But it only shows full stars, when I also want half stars. I inserted a SQLite row with a name and the ratingValue, in there the ratingValue stands as “3.5” but my application turns it into “4”. Even if my StepSize is “0.5”, even the default value […]

Android Studio Unit test SQLiteDataBase is null

I’m new to Unit testing and I want to test my SQLiteDataBase. I have a class named MySQLiteHelper that extends SQLiteOpenHelper. I have a class named LocationDataHandler that I use to add or delete elements from my DataBase. And I have a class LocationDataHandlerTest, that extends AndroidTestCase, to test my LocationDataHandler class. I’m trying to […]

Max size of an Android app's in-memory SQLite database?

How large can be the database of my Android app? Is there a limit? For performance and security reasons, I don’t want to store the database on the SD card.

SQLite sort special characters alphabetically

I’m building an application that is used to teach people French. When I try to sort some French words do not end up where I intended them to be, for example: Aller Boire En Être Vouloir Will be sorted in the following order: Aller Boire En Vouloir Être The SQL statement I’m currently using is: […]

Data gets populated from a particular table's date instead of all table in sqlite

I have three table namely trade, advance, and loan in which when I entered some values in loan it doesn’t get displayed until I enter some values in trade for that particular date/month. So can anyone tell me how I can overcome this issue? SELECT strftime(‘%m-%Y’, tradedate) as ‘month’, (SELECT IFNULL (SUM(FTL.tradebalanceamount),0 ) FROM farmertradelabel […]

Android autocomplete with SQLite LIKE works partially

I have a Restaurants table in my SQLite DB that have the following records | Name | Latin_Name | +——–+————+ | Манаки | Manaki | +——–+————+ | Енрико | Enriko | +———————+ Now I’m doing the search like this: From my fragment: String selection = DBHelper.COL_NAME + ” LIKE ? OR ” + DBHelper.COL_LATIN_NAME + […]

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