android-sqlite

How to copy android database sqlite file to sdcard?

[亡魂溺海] 提交于 2020-02-02 19:06:32
问题 I am trying to copy created database sqlite file from android memory to an sdcard but I am getting "failed to copy" error. Is there a way to create the database sqlite file so it can be easily copied? Do I need to set permissions anywhere on the device? 回答1: Yes you do need permissions and how depends upon the API if less than 23 then you need to have <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> in your manifest (AndroidManifest.xml). If 23 or greater then you

simple cursor adapter requires minimum api 11 issue

不羁的心 提交于 2020-02-01 05:18:07
问题 I am working on a app , in which i require to populate list view from the database. I am getting compatibility issue in following code dataAdapter = new SimpleCursorAdapter( this, R.layout.eventlisting, cursor, columns, to, 0); It requires min api level 11 , mine is 8. Is there any alternative for this to make this code work on api 8 as well. Can i use support library? 回答1: Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards

android biometric USB fingerprint authentication tutorial

房东的猫 提交于 2020-01-25 06:52:17
问题 I have a biometric USB fingerprint sensor for android devices. I want to develop an application that reads a user's fingerprint via sensor and store it into an SQLite database so that it can be verified when the user login. So, Are there any tutorials or code samples that explain how to do that? Thanks In Advance. 回答1: Reading users biometric materials and storing them in an SQLite database seems a suspect usage of biometrics on Android. Normally quite a bit of security measures go into

How to create a new table in Room dynamically?

天涯浪子 提交于 2020-01-25 05:43:09
问题 Help me out please. In my app user is able to create new database tables by pressing a button. User is also able to access this tables later to receive data from them. Currently I utilize good old SQLite via dataBaseHelper class, so I could just public static void createTable(String tableName) { databaseHelper.getWritableDatabase().execSQL("CREATE TABLE IF NOT EXISTS [" + tableName + "] (...columns)"); } and the job was done; Now I want to use Room library in my App instead of DataBaseHelper.

SQLite and database initialization

独自空忆成欢 提交于 2020-01-25 05:17:06
问题 I'm about to use a database on Android for the first time, but there is a thing I'm not sure to understand. Question 1 A database need to be created in an app ; which means I need to give some "time" to the creation/initialization of this database. This time can be quite long depending on the amount of datas I need to store, and I'm wondering, do we really need to create the database in the right app? I mean, isn't it better to just create a dummy app which will create and init my database,

send a row from a listview saved in database sqlite to another listview and make it do the same as the row in the first listview

家住魔仙堡 提交于 2020-01-24 19:30:42
问题 i have two activities each one of them have a listview the first one is connected to a data base and get its data from strings.xml i want to send a row to the other listview in the aother activity and make it do the same as if it was in the first list view i did that before but all the data was saved in the database directly (no strnigs.xml) here is my code please help me public class DB_Sqlite extends SQLiteOpenHelper { public static final String BDname = "data.db"; public static final int

send a row from one listview to another listview

旧城冷巷雨未停 提交于 2020-01-24 18:47:25
问题 i have two listviews in the same activity one of them have elements the other one is empty and i want to send any element to the second lisview by long click and i want the elements to do the same as it is in the first listview(open an activity) here is my code and please tell what to do: MainActivity.java import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle;

Sum over values by month in milliseconds

亡梦爱人 提交于 2020-01-24 14:32:33
问题 I have table with Values and Date. Values in Integer and date is Integer in milliseconds from 1970's... I need to get sum(value) for each month and i haven't any idea how to do it with date in milliseconds. Is it possible? Thanks. My table "entry" amount | date ---------------------------- 300 | 1390075200000 150 | 1390132500000 20 | 1391075200000 ... | ............. What i want to get: 01.2014 | 450 02.2014 | 20 .... 回答1: You have to convert the dates into a format supported by SQLite so

Datatype mismatch (code 20) while inserting

旧巷老猫 提交于 2020-01-23 03:15:05
问题 In my project im using sqlite database to save pictures and their locations. i get this error while trying to insert the data into my database: E/SQLiteLog: (20) statement aborts at 5: [INSERT INTO PHOTO VALUES(NULL,?,?,?,?)] datatype mismatch D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.tomer.finalproject, PID: 18550 android.database.sqlite.SQLiteDatatypeMismatchException: datatype mismatch (code 20) at android.database.sqlite

SQLite - Could not open database file

谁说我不能喝 提交于 2020-01-22 17:57:05
问题 I am coding a Xamarin Android application, and am getting an error when trying to create a SQLite database. Here is my code: string applicationFolderPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "CanFindLocation"); string databaseFileName = System.IO.Path.Combine(applicationFolderPath, "CanFindLocation.db"); SQLite.SQLite3.Config(SQLite.SQLite3.ConfigOption.Serialized); var db = new SQLiteConnection (databaseFileName); Here is the