android-database

Android: Delete entire database

天大地大妈咪最大 提交于 2019-12-04 12:17:15
问题 I would like to delete a complete database created by my application. Do you know any adb command, or android sentence to do it? 回答1: I think you need to start up your emulator with the command: -wipe-data 回答2: You can run the command: adb -s emulator-5554 shell (or whatever port you use) cd /data/data/<packagename>/databases/ By typing ls, you will see the databases created and you can remove the one you want with rm rm myapp.db See more here 回答3: Also, in Eclipse you can go to "Window ->

Realm Android exception occured during performFiltering()!

对着背影说爱祢 提交于 2019-12-04 06:44:18
问题 The app worked fine when I used Spinner. But when I tried AutoComplete Textview instead of Spinner, nothing is displayed when I type on it. Any help is appreciated. Logcat Warn: 08-23 14:01:13.485 9542-9542/com.vyshnav.realmexample W/art: Failed to find OatDexFile for DexFile /data/data/com.vyshnav.realmexample/files/instant-run/dex/slice-slice_9-classes.dex ( canonical path /data/data/com.vyshnav.realmexample/files/instant-run/dex/slice-slice_9-classes.dex) with checksum 0x0486ffcc in

How to convert video/audio file to byte array and vice versa in android.?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 10:04:27
Am trying to convert audio/video to byte array and vice versa, using below code am able converting audio/video files to byte array(see below code) but am fail to convert large file(more then 50MB files) is there any limit.? how to convert byte array to audio/video file.? kindly help me out. public byte[] convert(String path) throws IOException { FileInputStream fis = new FileInputStream(path); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] b = new byte[1024]; for (int readNum; (readNum = fis.read(b)) != -1;) { bos.write(b, 0, readNum); } byte[] bytes = bos.toByteArray();

Android: Delete entire database

时光毁灭记忆、已成空白 提交于 2019-12-03 07:41:19
I would like to delete a complete database created by my application. Do you know any adb command, or android sentence to do it? I think you need to start up your emulator with the command: -wipe-data You can run the command: adb -s emulator-5554 shell (or whatever port you use) cd /data/data/<packagename>/databases/ By typing ls, you will see the databases created and you can remove the one you want with rm rm myapp.db See more here Also, in Eclipse you can go to "Window -> Show View -> Other... -> Android -> File Explorer" Then navigate to "data/data//databases" Select the database file,

Room Using Date field

我是研究僧i 提交于 2019-12-03 06:53:35
I am using date converter class to convert my date object. However, I still encounter an error saying. error: Cannot figure out how to save this field into a database. You can consider adding a type converter for it. My Date Converter class public class DateConverter { @TypeConverter public static Date toDate(Long dateLong){ return dateLong == null ? null: new Date(dateLong); } @TypeConverter public static long fromDate(Date date){ return date == null ? null :date.getTime(); } } My Database table for using the date object. @Entity(tableName = "userFitnessDailyRecords") @TypeConverters

Database won't remove when uninstall the Android Application

依然范特西╮ 提交于 2019-12-03 02:36:46
问题 I have two major questions. Database won't delete when uninstall app. Downloaded files won't delete while unstable the app. There is a database in my android application. I create it by java class as follows. public DataBaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public DataBaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) { super(context, name, factory, version,

Database won't remove when uninstall the Android Application

五迷三道 提交于 2019-12-02 17:25:43
I have two major questions. Database won't delete when uninstall app. Downloaded files won't delete while unstable the app. There is a database in my android application. I create it by java class as follows. public DataBaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public DataBaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) { super(context, name, factory, version, errorHandler); } @Override public void onCreate(SQLiteDatabase db) { // creating required tables db.execSQL(CREATE

Reading a database from the assets folder [duplicate]

浪子不回头ぞ 提交于 2019-12-02 09:43:48
问题 This question already has answers here : Ship an application with a database (14 answers) Closed last year . I have a db file in asset folder how can I use it. I must be able to read and write the database file If I use SqliteDatabase.open(context.openassest().open(filrname),null); Exception db file not found Don't check. The syntax I have done correctly in my lap see the content 回答1: To utilise a packaged database (i.e one included as an asset) for full use the database must be unzipped

Reading a database from the assets folder [duplicate]

不羁岁月 提交于 2019-12-02 06:07:58
This question already has an answer here: Ship an application with a database 14 answers I have a db file in asset folder how can I use it. I must be able to read and write the database file If I use SqliteDatabase.open(context.openassest().open(filrname),null); Exception db file not found Don't check. The syntax I have done correctly in my lap see the content To utilise a packaged database (i.e one included as an asset) for full use the database must be unzipped (automatic) and copied to a suitable location (most often data/data/<package_name>/databases/<database_name> where <package_name>

Room cannot verify the data integrity

瘦欲@ 提交于 2019-11-28 17:25:09
I am getting this error while running program with Room Database Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number. It seems we need to update Database version, but from where we can do that in Room? When you first come across this message, you will most likely be working against an unreleased version of the database. If that is the case, most likely you should not increment the database version . Simply clearing app data will move you passed the exception. If you do not