android-sqlite

Android SQlite not updating the data

怎甘沉沦 提交于 2019-12-24 01:52:33
问题 My DatabaseHandler Class: public class DatabaseHandler extends SQLiteOpenHelper { private static final String LOG_TAG = "debugger"; //database version private static final int DATABASE_VERSION = 1; //database name; private static final String DATABASE_NAME = "appdb"; private static final String TABLE_PROJECT = "projects"; //Project Table Columns private static String PROJECT_ID = "Project_id"; private static final String PROJECT_NAME = "Name"; private static final String PROJECT_DESCRIPTION =

Using Room DB in library project

夙愿已清 提交于 2019-12-24 00:39:58
问题 I am trying to integrate room DB in a library project apply plugin: 'com.android.library' . . . . . compile "android.arch.persistence.room:runtime:$rootProject.roomVersion" annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion" When I use this library inside my app and try to access Room DB, it always crashes and give me following exception Android room persistent: AppDatabase_Impl does not exist However when I use room DB directly in my application it works

How to use _COUNT in BaseColumns

旧巷老猫 提交于 2019-12-23 22:15:39
问题 I've been reading up on BaseColumns ](https://developer.android.com/reference/android/provider/BaseColumns.html) in Android to help structure my database schema. I know that _ID is a unique identifier for the row that you have to create yourself: protected static final String SQL_CREATE = "CREATE TABLE " + TABLE_NAME + "( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + ...; I also read that _COUNT is used to refer to the number of rows in a table. However, when I tried using _COUNT , I got

Android Live data observer exception

。_饼干妹妹 提交于 2019-12-23 18:52:49
问题 I am trying to implement the new android architecture components and have used live data in the fragment and view model but when I add an observer to the live data the app crashes throwing this exception. Process: com.nrs.nsnik.architecturecomponents, PID: 3071 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nrs.nsnik.architecturecomponents/com.nrs.nsnik.architecturec omponents.view.MainActivity}: java.lang.ClassCastException: android.arch.lifecycle.LiveData

Getting NoClassDefFoundError while trying to use Proguard and SQLcipher in Android

与世无争的帅哥 提交于 2019-12-23 18:15:59
问题 I am getting a ava.lang.NoClassDefFoundError: net/sqlcipher/CursorWindow when trying to run my app using sqlicipher and proguard. The project works perfectly without proguard enabled. The first time I use sqlcipher to create a new db I get the error above. I have looked at another SO question that is seemingly identical, but I have tried the answers from that question and I'm still getting the error. Android Proguard SqlCipher NoClassDefFoundError Here is my entire proguard-properties :

Update all rows in a column to new value

℡╲_俬逩灬. 提交于 2019-12-23 12:09:39
问题 Apologies, I am sure this has been asked plenty of times but I have searched around for a good example and haven't been able to find one. I'd like to run a method to insert a value into a particular column for all rows in a table. To give you an idea of the methods and queries I'm working with, this is my working update method for my Students table: public void updateStudent(long id,String name, String age, String points, String teachernote,byte[] blob) { ContentValues cv = new ContentValues(

What is the difference between REFERENCES with, or without a FOREIGN KEY

南楼画角 提交于 2019-12-23 10:57:31
问题 In regards to SQLite , What is the difference between REFERENCES with, or without a FOREIGN KEY? What is the difference between this CREATE TABLE players_set ( _id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, player_id INTEGER REFERENCES players ( _id ) ON DELETE CASCADE, players_set_id INTEGER REFERENCES players_set_names ( _id ) ); and this: CREATE TABLE players_set ( _id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, player_id INTEGER, players_set_id INTEGER REFERENCES players_set_names ( _id

Android- setPeriodic for JobScheduler won't work

谁说胖子不能爱 提交于 2019-12-23 10:17:46
问题 I've wrote an app for creating and reminding task which uses local SqliteDatabase. I wrote a jobScheduler service to check the device time and date with tasks on the database and if matches shows a push notification. What I want also is service to run in background and check the data every 5 seconds . but when I write builder.setPeriodic(5000); builder.setPersisted(true); the service stops checking data. Here's my code MainActivity public class MainActivity extends AppCompatActivity {

function to check if SQLite is using journal_mode=WAL or journal_mode=DELETE

北城余情 提交于 2019-12-23 09:32:09
问题 I was looking for function which would help me to see which journaling mode is enabled.. I looked here too list of function There was function to check database status sqlite3_db_status(....) but status parameter didn't have option for check journaling mode Is there a function or any way to find if sqlite db is using WAL-mode or normal journaling mode ..!! 回答1: To query the journal mode of a connection, execute PRAGMA journal_mode and read the result. 来源: https://stackoverflow.com/questions

can I open a read alone database from res/asset folder in android without copying to database folder

岁酱吖の 提交于 2019-12-23 05:11:57
问题 I want to open a database and read some values from asset or resource folder.I don't want to write any data to DB.since my db size is huge I cant copy it to database folder as it will consume lot of time and memory. Any help? 回答1: Sorry, but this is not possible. SQLite cannot work with purely an InputStream , which is all you can get from an asset or raw resource. Remember that assets and resources are not files on the device — they are only files on your development machine. 来源: https:/