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
votes
1 answer

Unable to insert data into second table in android

``I am using SQLite Database.I have created two tables.first table is user table ,it is successfully create and inserted.but in my second table also successfully created but does not insert.this is my problem.Thank for advances.. This is OnClick…
rafeek
  • 103
  • 1
  • 4
  • 13
-1
votes
1 answer

Getting database values in if statement

I have a database which contains multiple phone numbers. I need to check if the database contains a specific number. How do I get the database values in an if statement? Should i use Array List? This is what i have been doing so…
shinilms
  • 1,494
  • 3
  • 22
  • 35
-1
votes
2 answers

Delete query not working (db.delete, db.exectSQL, db.rawQuery....)

I am trying to remove certain rows of a table in Android. I tried running directly through the SQL command "execSQL" and "rawQuery". Right now I'm using "db.delete" where I step in the argument "where" the rows that I want to remove. This is the…
-1
votes
1 answer

My db app stops working

I wrote some code. It does not give errors, but it simply does not work. When I try to debug it, it says: Unfortunately your app has stopped. Kindly help me, I am new to developing The DataBase Helper Class is public class DatabaseHandler extends…
Ebad Ahmed
  • 63
  • 1
  • 1
  • 6
-1
votes
1 answer

RadioButton values are not saving into database

In the below code radiobutton values are not saving into the database. When I am debugging it was showing null. Is it necessary to set text for radiobuttons or using textview names? We can save the values of the radiobuttons. This my layout…
care567
  • 231
  • 3
  • 15
-1
votes
1 answer

Android database syntax error on the DataBase class

I've tried to insert in my database some value but I get syntax error and I've no idea why... Can anyone help me? :) Database code: package com.cetabo.trackingpoint.util; import android.content.ContentValues; import android.content.Context; import…
cavaler12345
  • 367
  • 1
  • 5
  • 15
-1
votes
2 answers

Android: Rerun Database onCreate() if it fails

Because of some poor decisions, I am stuck with an onCreate() in my SQLiteOpenHelper class that can run for up to 5 minutes. The user could turn off his phone, or force close the app during this process, meaning my onCreate() will be canceled…
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
-1
votes
1 answer

SQlite-Foreign key

hello i'm a beginner in sqlite in android i made a 2 tables database and i'm trying to make a foreing key in the second table which is the id of the first table here is the code and i would appreciate if you tell me if there is other errors in the…
-1
votes
1 answer

I am not able to open database and query on it

strong text I am not able to open database and query on it. i want to access row of table that is passed from a different java file using intent value. Please help ! import java.io.File; import java.util.ArrayList; import…
Vinit Khanna
  • 81
  • 1
  • 1
  • 10
-1
votes
1 answer

E/SQLiteLog﹕ (1) table Users_Table has no column named Monday_Calories

Im doing a database which will store user data, username password age gender height email and weight are inputed by the user and the values for the other columns are left as 0.0. when i debug the app i get the following error E/SQLiteLog﹕ (1) table…
JH_Dev
  • 426
  • 7
  • 26
-2
votes
2 answers

android studio SQL lite database error (android.database.sqlite.SQLiteException)

I copy/paste the already created .db file to my android studio project, but it is crashing my app. That database file is working fine on another android studio project but it is giving exceptions and causing the app to crash on my current project.…
-2
votes
1 answer

UNIQUE constraint failed: type.ps

My dictionary app project uses SQLite for storing data. I'm getting UNIQUE constraint failed: type.ps in the methodcreateTablesAndProcess() when I run the app. createTablesAndPorcess method: public final void createTablesAndProcess() { boolean…
Nithis Kumar
  • 278
  • 2
  • 5
  • 21
-2
votes
1 answer

How to connect to phpmyadmin database using OkHttp3 in Android

I’m new to Android, in order to prepare for my last school exam, I was asked to put an Android application solution using an external database on phpmyadmin ( wampserver). My connection is done in the MainActivity file, using OkHttp3 and overriding…
-2
votes
1 answer

Accessing Database created in one activity from another activity

I have created an instance of my database helper class in the main activity. I want to access that instance from any another activity where I can update that database. I have created an instance with getApplicationContext() as context but it's…
-2
votes
1 answer

How to add value from Android app to sql database?

I am getting these error of SQLiteException while making an app like employee tracker and basically it does not adding the data in the database. I am making this app using eclipse and sql database. the error: 1. Here is the error sheet:…