Questions tagged [android-database]

General programmatic usage of databases on Android

Databases and tools related with persistence supported by the Android operating system.

584 questions
1
vote
0 answers

Optimised way of accessing Realm values

I have a Realm objects User, Session, HeartSession which has the following structure. User { UUID: String (primary key) RealmList sessions } Session { UUID: String (primary key) RealmList
User
  • 1,186
  • 4
  • 22
  • 36
1
vote
1 answer

How to fix Index 0 requested, with a size of 0 in Android

I want save user's info in Internal Database. but when click on one user for show info, show me this error : android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0 SQLiteOpenHelder code : public class dbOpenHelper…
dfgh
  • 29
  • 7
1
vote
2 answers

Getting only last values from database in android

I have stored values in database and now I am trying to get values from database. all values are stored in data base but when I get values in String list it only return the last values .following is my code .any help will be appreciated.…
Sohail Yasin
  • 344
  • 1
  • 3
  • 16
1
vote
0 answers

Android device monitor does not show database file in android studio

Android device monitor does not show database file in android studio. Under data/data/pakageName it shows only two folder; cache. shared_pref Note:data insertion and retrieval works perfectly. plz help thanx in advance
Hanan
  • 1
  • 1
  • 10
1
vote
3 answers

Best Practice - Saving Activity data to android database

I currently store my app data for an Activity in a Parcelable object. On orientation change, I save it and load it by using onSaveInstanceState and onRestoreInstanceState. I want to save the data to the database when the user exits the…
1
vote
2 answers

Spinner not adding all topics from DB

I have a database that is storing topics. I want to display all topics in a spinner. I can get the first topic in, but not the other three. All three log though: topicCursor: android.database.sqlite.SQLiteCursor@429ba4a8 str: test0 labels:…
1
vote
2 answers

Inserting in SQLite database from file, only one row inserted

I'm inserting rows in android SQLite database from a file. In the onUpdate function in the databaseHelper I call the insertInDb function: InputStream is = null; AssetManager assetManager = context.getResources().getAssets(); String fileLine =…
Christoph
  • 33
  • 3
1
vote
1 answer

One to many in DB Flow

I am trying to use DBFlow with my objects where i have relationship One TO Many (User have many Businesses), i was following tutorial at their offical wiki but it just dont want to work. Here are my user: @Column @PrimaryKey(autoincrement =…
HyperX
  • 1,121
  • 2
  • 22
  • 42
1
vote
3 answers

How can I make an Adapter ListView on a Fragment using an SQL database?

I'm trying to call or see a ListView with this kind of specification: Wireframe Here is my code. This is the fragment named EducacionFragment, and here is where I want to call the layout "eventos": public class EducacionFragment extends…
1
vote
0 answers

Implement editing contacts after being stored in the database

I'm adapting an application that manages contacts with database interaction. In the application, I am inserting and deleting contacts but I'm struggling to implement the method to edit the contacts and record the contact edited in the database. The…
1
vote
2 answers

How to apply SELECT date('now') query in android?

I am working on a project and now I have been stuck on a weird stage. I know that we can execute any query that has to do anything with database we can write that using: Cursor cursor = db.rawQuery("SELECT * FROM table_name", null); But now I want…
activesince93
  • 1,716
  • 17
  • 37
1
vote
0 answers

how do i pull databases from third party apps in non rooted device

i'm doing a dictionary project and i need some databases from an app in google play.but there is no folder in SD card or internal storage that contains databases.is there any way to pull this third party app's databases and use it in project?
Mahdi Javaheri
  • 1,080
  • 13
  • 25
1
vote
2 answers

Closing cursors/database in Android

Here is the code: public List getXImages() { List images = new ArrayList(); SQLiteDatabase database = this.getWritableDatabase(); String sql = String.format("SELECT %s, %s, %s FROM %s", A, B, C,…
b85411
  • 9,420
  • 15
  • 65
  • 119
1
vote
1 answer

How can I pass database records to second activity and display in it with listview?

I'm new to android and java. Let me explain my project. I'm writing an Android application. I want to create a database and insert,delete, modify datas from textviews. And display these datas using ListView another activity. My first question is,…
1
vote
0 answers

How to check whether the password entered is same as the password given in database?

I'm creating an edit profile page, where I need to validate whether the old password is same as the one already stored in the database. How can I do this? Below is my code. How to retrieve saved column value from database locally? public class…
Adarsh
  • 89
  • 4
  • 14