Questions tagged [content-values]
42 questions
0
votes
1 answer
Room Insert ContentValues by using SqLiteOpenHelper methods
I am using Room to manage SQLite databasae in my app. The thing is that I am migrating a project, in which I download some data from a private webservice and finally I am receiving a ContentValues object which contains all the data to save to my…

mantc_sdr
- 451
- 3
- 17
0
votes
1 answer
MediaStore: After updating the file which is created by my app it cannot be deleted easily
Next code for deleting a file which my app owns works ok, there is no exception RecoverableSecurityException because the file was created by my app (using ContentResolver.insert(...) method)
getVideoFileContentUri(context, file)?.let { uri ->
…

user924
- 8,146
- 7
- 57
- 139
0
votes
1 answer
How to insert values with Foreign KEY in SQLite?
I am new with Android Sqlite Database.
I have created a database with SQLite in Android and I have a table Student_details which use a foreign key of the table: Student, I have made the id as AUTOINCREMENT.
And i tried to return the value of the…

Md Azharul Islam Somon
- 113
- 1
- 9
0
votes
1 answer
escaping sqlite column name in java ContentValues
I have an SQLite table with a column named 'group'. I've tried delimiting with single-quotes and square brackets. Each time, it inserts a '0' with no error message. At least when I leave it alone, I get an error message:
2019-11-30 16:18:43.634…

Adam
- 1
- 2
0
votes
1 answer
How can I insert data into the SQLITE database with a foreign key using a content values?
I have a table below:
+=================+
+ CATEGORY_TABLE +
+=================+
+ PK | owner_id +
+ FK | task_id +
+ | lastname +
+ | firstname +
+ | etc... +
+=================+
+=================+
+ TASK_TABLE …

no_profile
- 387
- 5
- 15
0
votes
0 answers
Content values are assigned null even after putting values in it
As a part of Unit testing I wanted to insert values to DB using content resolver. But when I tried this,
@Before
public void runBeforeTestSignOut() {
ContentValues values = new ContentValues();
String userId="123";
…

Subin T
- 157
- 1
- 1
- 11
0
votes
1 answer
Android ContentValues.get() null vs value is missing
I'm writing a ContentProvider class (for a book inventory) and got stuck when checking for validity of the entries in the insert() function. If the value is not valid I would then throw an IllegalArgumentException.
One row is the price of the book…

HappySka
- 3
- 2
0
votes
3 answers
ContentValues only entering last value into database
I'm still fairly new to Android Studio and I have looked at this question in different forums but I haven't exactly found one that pertains to my problem specifically (or I'm not experienced enough to recognize it at least.)
I have created an…

Jonathan
- 487
- 1
- 9
- 19
0
votes
2 answers
How do I make Integers and Doubles save properly to ContentValues?
I'm trying to retrieve data from CSV to SQLite DB, all the Strings are properly saved. But Integers and Doubles are not, all of them saves as null.
But how to split Integers and Doubles and put them in ContentValues?
Here I'm trying to make this…

Scooltr
- 37
- 7
0
votes
1 answer
How to insert list of objects using ContentValues.put()?
I am trying to insert data into the SQLite database and for that I have written a simple method to insert the data that I get from the API as shown below:
public static ContentValues gameInfoToContentValues(@NonNull GameInfoList game) {
…

Nithin Prasad
- 554
- 1
- 9
- 22
0
votes
1 answer
Update all rows in database
What is the effective way to update all records in the database. I try to update all rows for the same key independent from table id, like this:
for (int i = 0 ; i < rowsCount ; i++) {
cv.put(column2, columnValue[i]);
cv.put(column3,…

Sam Joos
- 430
- 2
- 11
- 25
0
votes
0 answers
Android: Where conditions with ContentValues insteard of String[] in SQLiteDatabase update function
Currently, the update function in SQLiteDatabase uses String[] for the Where args.
update(String table, ContentValues values, String whereClause, String[] whereArgs)
I find this very strange
A) Normally values are passed using the ContentValues…

Enrico
- 41
- 1
- 4
0
votes
1 answer
ContentValues Insert always return the -1
db.insert(table_name,null,contentValues); is always returning -1 and it is not inserting the values in the databases.
Can you please help me to figure out what I'm doing the wrong?
database_class.java:
public class database_class extends…

Mudasir Sharif
- 733
- 2
- 15
- 31
0
votes
1 answer
ContentValues put error
Keep getting this error:
Error inserting android.database.sqlite.SQLiteException: near "null": syntax error (code 1):
, while compiling: INSERT INTO exercises(null) VALUES (NULL)
I am trying to insert values into my SQLite database when its being…

rolomcflurry
- 117
- 8
0
votes
1 answer
ContentValues getAsLong NullPointerException
I have a ContentValues that I'm parsing for data. I just received a very strange crash report:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke
virtual method 'long java.lang.Long.longValue()' on a null object
…

Anthony
- 7,638
- 3
- 38
- 71