android-database

Android Realm Abstract Class Instantiate

妖精的绣舞 提交于 2019-12-12 03:11:31
问题 I am trying to setup an AuotoCompleteTextview (in my MainActivity) where data is fetched from Realm database. So I'm using an adapter as following: public abstract class FilterableRealmBaseAdapter<T extends RealmObject> extends ArrayAdapter<T> implements Filterable { private final RealmResults<T> mRealmObjectList; private List<T> mResults; public FilterableRealmBaseAdapter(Context context, @LayoutRes int layout, RealmResults<T> realmObjectList) { super(context, layout); mRealmObjectList =

Diffrent Result After Save Number As Long in Database

三世轮回 提交于 2019-12-11 17:37:16
问题 i want to save 10 digit numbers in database , but after save , when show the numbers ,The stored numbers are stored As other numbers sorry for my poor english my Database : get Number : long studentId = Long.parseLong(studentId_et.getText().toString()); database.OpenDatabase(); database.SaveStudent(studentId , classId , studentName); database.close(); save Number : public void SaveStudent(long studentId, int classID, String studentName) { Cursor cursor = database.rawQuery("select * from " +

What version of SQLite added support for the lead() and lag() functions?

纵然是瞬间 提交于 2019-12-11 11:45:33
问题 I am trying to use the following query as part of a larger query in my Android SQLite datbase, but it seems to me that the errors I'm receiving point to Android SQLite not supporting the lead() function yet. I've tried looking through the release log on sqlite.org and was unable to find when support for window functions like lead() were added. I've also been unable to find any other source for this particular information. My query: ... SELECT * , CASE WHEN WorkTypeID != 1 THEN lead

How to find out user is present in Sqlite Database using android?

好久不见. 提交于 2019-12-11 08:17:14
问题 I am working on a login/register app just for training as I am a beginner everything is working except for a small problem but I don't know how to fix it , I tried searching but couldn't find anything here is the part of my database.kt fun userPresent (user: String,pass: String):Boolean { val db = writableDatabase val query = "select * from $TABLE_NAME where username = $user and password = $pass" val cursor = db.rawQuery(query,null) if (cursor.count <= 0) { cursor.close() return false }

How to upgrade database with Sugar Orm?

╄→гoц情女王★ 提交于 2019-12-11 07:31:38
问题 I have a simple entity: public class MyEntity extends SugarRecord { String name; int value; public MyEntity() { //empty ctr for sugar orm } public MyEntity(String name, int value) { this.name = name; this.value = value; } } On App start I make an instance and save it like this: Log.i("db_test", "count_before: "+MyEntity.count(MyEntity.class)+""); new MyEntity("name", 10).save(); Log.i("db_test", "count_after: "+MyEntity.count(MyEntity.class)+""); In the log I can see: 04-12 14:58:52.538: I/db

ContentProvider not called onCreate after deleting database

点点圈 提交于 2019-12-11 06:16:05
问题 I have created ContentProvider which creates one Database on application launching. Now In that application, I am doing process of deleting database when user logout from app. After that when I come again to login, the ContentProvider cant call onCreate() of overrided class. Is there any way to recreate database using ContentProvider? 回答1: I found solution as, First of all I referred Refresh/Reload database reference in custom ContentProvider after restore but not satisfied with answer

SQLite: No Such Table Error Android P problem

旧巷老猫 提交于 2019-12-10 05:10:34
问题 Until Android P everything worked fine with my code but now in Android P I'm having a lot of problems working with databases. I have .db sqlite database files stored on assets folder. I was importing them into the database space of android and it worked fine until Android P. In android P I'm getting this exception: SQLite: No Such Table Error I searched here and found this, and I tryed to apply the accepted answer: Android P - 'SQLite: No Such Table Error' after copying database from assets

SQLite: No Such Table Error Android P problem

﹥>﹥吖頭↗ 提交于 2019-12-05 12:00:45
Until Android P everything worked fine with my code but now in Android P I'm having a lot of problems working with databases. I have .db sqlite database files stored on assets folder. I was importing them into the database space of android and it worked fine until Android P. In android P I'm getting this exception: SQLite: No Such Table Error I searched here and found this, and I tryed to apply the accepted answer: Android P - 'SQLite: No Such Table Error' after copying database from assets The problem is that now I'm having another problem and It still doesn't works. Now I'm having the

Accessing the database of one application from another application

二次信任 提交于 2019-12-05 00:35:38
问题 I've built an application and now I want to copy the database of that running application using my new backup application. I create my database path by doing DB_PATH + DB_NAME , using the following values: DB_PATH = "/data/data/iCam.Cam/"; DB_NAME = "testdb.db"; I have code which copies the database from the given path to the SD Card. However, when I initially check the database using the following method, it returns false : public boolean checkDataBase() { SQLiteDatabase checkDB = null; try

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

喜夏-厌秋 提交于 2019-12-04 15:47:02
问题 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