android-sqlite

how to get DB sqlite data from strings.xml so when i change the locale all the data can be translated

南笙酒味 提交于 2020-01-15 02:32:04
问题 i have database with all data saved inside it how can i change that and make get the data from strings,xml so when i change the locale all the data can be translated to locale language here is my code: public class DB_Sqlite extends SQLiteOpenHelper { public static final String BDname = "data.db"; public static final int DBVERSION = 1; /*<<<<< ADDED BUT NOT NEEDED */ public static final String TABLE_FAVOURITES = "mytable"; public static final String FAVOURITES_COL_ID = BaseColumns._ID; /*<<<<

Android Studio does't check/highlight Kotlin Room DAO queries when string occupies more than 1 row

让人想犯罪 __ 提交于 2020-01-14 10:27:08
问题 When I'm trying to break query for better readability/comprehension it stops being checked by IDE. This occurs on Android Studio 3.2 canary 16 and 3.1.2 stable, kotlin version 1.2.41. When Room DAO is java class/interface everything works fine. Is it possible to have the same checking/highlighting for 2+ rows queries in kotlin as in java? 回答1: This is supposed to be resolved in AS 3.6, but, for now, the workaround noted at https://issuetracker.google.com/issues/130141151#comment3 does the

Export SQLite database into XML file

♀尐吖头ヾ 提交于 2020-01-14 05:56:08
问题 How can I export data from database and store it in an XML file? My database schema looks like this: private static final int DATABASE_VERSION = 4; public static final String DATABASE_NAME = "instruments.db"; private static final String TABLE_NAME = "instrument_table"; public static final String COL_1 = "ID"; public static final String COL_2 = "NAME"; public static final String COL_3 = "LOCATION"; public static final String COL_4 = "INFORMATION"; public static final String COL_5 = "PHOTO";

SQLite database leak found

拜拜、爱过 提交于 2020-01-13 20:18:14
问题 I'm creating an application. I'm getting this error: 11-08 13:46:24.665: ERROR/Database(443): java.lang.IllegalStateException: /data/data/com.testproj/databases/Testdb SQLiteDatabase created and never closed I can't seem to find the reason for this, as it somethimes shows me the error, sometimes not. Here is my code: public class SQLiteAssistant extends SQLiteOpenHelper { public SQLiteAssistant(Context context){ super(context, DB_NAME, null, DB_VERSION_NUMBER); this.myContext = context; }

Calling custom SQLite functions in Room

前提是你 提交于 2020-01-13 18:06:57
问题 I include a custom build of sqlite in my app. I have several custom functions in that library, and I would like to call them from @Query in my Room DAOs. However I get an error that Room couldn't find those functions. Is there a way to tell Room that they exist WITHOUT using a @RawQuery? 回答1: From Google: Room can't verify queries with custom functions, please annotate your method with @SkipQueryVerification . Room verifies your Dao queries using sqlite-jdbc which uses a vanilla prebuilt

Calling custom SQLite functions in Room

心不动则不痛 提交于 2020-01-13 18:04:03
问题 I include a custom build of sqlite in my app. I have several custom functions in that library, and I would like to call them from @Query in my Room DAOs. However I get an error that Room couldn't find those functions. Is there a way to tell Room that they exist WITHOUT using a @RawQuery? 回答1: From Google: Room can't verify queries with custom functions, please annotate your method with @SkipQueryVerification . Room verifies your Dao queries using sqlite-jdbc which uses a vanilla prebuilt

Using SQLCipher with Android [duplicate]

房东的猫 提交于 2020-01-11 07:45:10
问题 This question already has an answer here : Encrypt exisiting database in Android (1 answer) Closed 4 years ago . I have previously asked this question and have not got any appropriate answer. I have an app published in the Play Store which makes heavy use of SQLite database. Now I need to secure the database using SQLCipher. Here are some problems I am facing. 1) How can I seamlessly integrate SQLCipher with my existing unencrypted database, so that my app works as it works normally but now

Save data in activity's onDestroy method

此生再无相见时 提交于 2020-01-11 01:48:08
问题 I'm writing a tasklist and have Project object, which holds all the tasks (and metadata). I use action log, so when tasks changes i do not save it immediately to database, just keep it in memory to dump in database on activity finish. Activity's onDestroy method is best place for this: if no onRetainNonConfigurationInstance method was called I start service to save project (one's instance is stored in Application). Saving is expensive: In DB project have revision, so I save new data, change

SQLite unable to open database file (code 14) on frequent “SELECT” query

岁酱吖の 提交于 2020-01-09 19:33:55
问题 I have following class "Singleton" to handle SQLite connection and to make sure to have 1 instance of connection for whole process/app: public class DBController { private static DBController instance = new DBController(); private static DBHelper dbHelper; public static DBController getInstance() { return instance; } public SQLiteDatabase dbOpen(Context context) { if(dbHelper == null) dbHelper = new DBHelper(context); return dbHelper.getWritableDatabase(); } } And DBHelper class itself:

no such table when i add a new table

こ雲淡風輕ζ 提交于 2020-01-07 07:42:14
问题 i think function onUpgrade is not working becuase before i add a new table .it's not error. when i add category table (a new table) . i change database_version = 2 from 1 when i run emulator .log cat sue "No such table category" and i don't know how to modify it. please check and tell me why onUpgrade isn't work. This is my code (BookDBHelper) import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import