sqliteopenhelper

How do i delete specific rows in SQLite Database

痞子三分冷 提交于 2019-12-13 02:11:49
问题 I am new to android and i am having trouble understanding the delete function in sqlite database.I have created my database using the string private static final String TABLE_NAME="NameInfo"; private static final String POSITION_DB ="_id"; private static final String Name_DB ="name"; private static final String JSONOBJECT_DB="json"; private static final String TIMESTAMP_DB="time"; private static final String USERRATING_DB="userrating"; private static final String DATABASE_NAME ="database.db";

SQLiteOpenHelper: onCreate() method not called on physical device

余生长醉 提交于 2019-12-12 20:18:21
问题 I have done many tests on an android emulator running in version 4.4. On my app I create a sqlite database with one table using SQLiteOpenHelper: package com.findwords.modeles; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import com.findwords.MainActivity; import com.findwords.controleurs.MenuController; import java.io.FileOutputStream; import java.io.IOException;

Can't downgrade database from version `n` to `n-1` on Samsung

感情迁移 提交于 2019-12-12 09:34:11
问题 I have an application with a database, created and opened using the standard SQLiteOpenHelper. Whenever I upgrade the database version, I also upgrade the application's version code, so there is no way for the database to go down (the database version number is always increased, never decreased). I disabled database backup in my app by setting the android:allowBackup property to false. But when I upgrade the app on the Play Store, I get a lot of crash Can't downgrade database from version n

The source attachment does not contain the source for the file SQLiteOpenHelper.class

落花浮王杯 提交于 2019-12-12 01:29:54
问题 I had a sample app in android version 4.2. I had set Breakpoints for each and every line. At the time of debugging, suddenly the debugging stopped saying that "The source attachment does not contain the source for the file SQLiteOpenHelper.class". I attached the jar file and still it reports the error. Installed everything currently. But dont know the cause for this error. This is my MainActivity.java package com.example.newwaterreadingapp; import java.util.Calendar; import android.os.Bundle;

Code 14: Unable to open database

ぐ巨炮叔叔 提交于 2019-12-11 16:45:05
问题 I know this question has been asked before. But, the problem is, the same code (for database handler) is working for another app, but not the one I'm currently working on. I've even made sure the permissions are given by checking the permissions in settings. Here's the logcat: 05-13 15:35:45.693 29696-29696/com.example.hack.corrector E/SQLiteLog: (14) cannot open file at line 31282 of [5a3022e081] (14) os_unix.c:31282: (21) open(/data/user/0/com.example.hack.corrector/databases/) - 05-13 15

Is it possible to use ContentProvider and direct data access to Database in Android?

本秂侑毒 提交于 2019-12-11 15:13:51
问题 I have application that uses direct data access to it's Database. I have nothing to expose outside of it for other applications. As CommonsWare says somewhere on SO, "if you have nothing to expose - don't use ContentProvider". Now, I want to add widget to display a couple of strings from one of the tables, storing in Database. Should I refactor the direct access code to the ContentProvider pattern? Is there a way to use direct access to Database from widget? Is there a way to have both

How can I write SQLite Real vals to Java BigDecimal values?

大兔子大兔子 提交于 2019-12-11 10:04:00
问题 I have a class like this: public class DeliveryItem { private int _id; private String _invoiceNumber; private String _UPC_PLU; private String _vendorItemId; private int _packSize; private String _description; private BigDecimal _cost; private BigDecimal _margin; private BigDecimal _listPrice; private int _departmentNumber; private String _subdepartment; private String _quantity; public void setID(int id) { this._id = id; } public int getID() { return this._id; } . . . The cost, margin, and

How to reset an application states when upgrading from the market

一个人想着一个人 提交于 2019-12-11 07:43:00
问题 This question was migrated from Android Enthusiasts Stack Exchange because it can be answered on Stack Overflow. Migrated 8 years ago . As a developer, I have applications already published on the market. When users download the new version, I want the application to clean its states ( SharedPreferences , SQLite schema ... ). I read about SQLiteOpenHelper. I suppose when I'm loading a new .apk on the device from Eclipse, the app still keeps its previous SharedPreferences . If the DB schema

SQLiteOpenHelper getWritableDatabse() fails with no Exception

只谈情不闲聊 提交于 2019-12-11 04:40:27
问题 I have a very strange problem. It only shows from time to time, on several devices. Can't seem to reproduce it when I want, but had it so many times, that I think I know where I get it. So I have a Loader which connects to sqlite through a singleton SQLiteOpenHelper : try { Log.i(TAG, "Get details offline / db helper: "+DatabaseHelper.getInstance(getContext())); SQLiteDatabase db=DatabaseHelper.getInstance(this.getContext()).getWritableDatabase(); Log.i(TAG, "Get details offline / db: "+db);

Android SQLiteDiskIOException in getReadableDatabase(), native_setLocale, SQLiteOpenHelper

感情迁移 提交于 2019-12-11 03:06:51
问题 Recently I've run into a problem connected with using SQLiteOpenHelper. Few users reported the error I can't reproduce: android.database.sqlite.SQLiteDiskIOException: disk I/O error at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method) at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:1987) at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1855) at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820) at