Questions tagged [content-values]
42 questions
110
votes
10 answers
How to insert a SQLite record with a datetime set to 'now' in Android application?
Say, we have a table created as:
create table notes (_id integer primary key autoincrement, created_date date)
To insert a record, I'd use
ContentValues initialValues = new ContentValues();
initialValues.put("date_created", "");
long rowId =…

droidguy
- 1,101
- 2
- 8
- 4
6
votes
1 answer
Object Has been collected cannot evaluate ContentValues.values.tostring()
Can anyone tell me what this is about. Im getting this error when i am adding data in database. its Happening only for a particular row. I tried finding answer or reason over the internet. but in vain. The screenshot
public void…

Rahul Agrawal
- 521
- 6
- 24
3
votes
0 answers
Is there a way to tell Android to show the "missed call" notification?
In a VoIP application that "catches" the system's outgoing calls, I also put information about the calls into the phone's call log. For a missed call the code is like below:
ContentValues values = new…

larshson
- 41
- 5
2
votes
1 answer
Creating a contact and sharing it as v-card/vcf file programmatically in android kotlin
I have data of contact locally in the app, I want to create a contact object and share it as v-card or vcf file to other phone using whatsapp, facebook etc.
Most of the solutions are based on getting contacts from contacts list and then sharing…

Mobile Developer iOS Android
- 6,005
- 5
- 34
- 58
2
votes
2 answers
Default calendar id for android
I am trying to add event automatically but I need calendar id for this
If I add event to calendar with id = 1 sometimes it does not exist or does not depend to event I add
ContentValues cv = new ContentValues();
cv.put("calendar_id", 1);
id…

Dima Dehtiarov
- 95
- 1
- 10
2
votes
1 answer
Error casting Object[] to ContentValues[]
I'm following a tutorial about content providers and, in a specific code, they inserted some data using a bulkInsert method. They also used a Vector variable (cVVector) to store all the ContentValues.
Code that was mentioned:
if (cVVector.size() >…

Thiago Ferrao
- 25
- 4
2
votes
1 answer
Sqlite: how do I increment a row value by +1?
I have a TOTALCOUNT table with a PK _id column and an integer column "CARDNUM". I want to set the default value of CARDNUM to zero. And then increment CARDNUM by +1 each time a new row is inserted into the database. So 5 row inserts would produce…

AJW
- 1,578
- 3
- 36
- 77
1
vote
0 answers
MediaStore update SQLiteDatabase Error: table album_art has no column named relative_path
Weird thing is, i tried it on a real device and it works fine. Only on emulators it's not working for some reason.
I even tried lowering the api levels, but still not working.
I tried changing the song name only, everytime this line shows up even…

Vince VD
- 1,506
- 17
- 38
1
vote
2 answers
Insert Gson Data into Android Sqlite
I am calling a web service I got data in array[]. I wanted to insert this data inside sqlite database. I have database structure same at server and sqlite as well.
Let's start with model class
public class RateList {
public int id;
public…

Ashish Kudale
- 1,230
- 1
- 27
- 51
1
vote
2 answers
How to encode and append ContentValue values into an URL
Earlier when NameValuePairs were available directly it was easy to encode and append URL variables using:
String UrlString = URLEncodedUtils.format(nameValuePairs, "utf-8");
But now they have been deprecated I moved onto using ContentValues for…

Maven
- 14,587
- 42
- 113
- 174
1
vote
1 answer
Query in ContentValues
I have to insert a lot of rows in my SQLite Database and for some tables
a specific value of each row has to be converted into an other using the value of an other table.
Actually, I have this function which is working well:
public void myFunction(…

Nicolas Cortell
- 659
- 4
- 16
0
votes
1 answer
Are there alternative azurerm_api_management_api content_value paths?
I am trying to create a new Azure API using the Terraform module azurerm_api_management_api. An example of the snippet of code I'm using is as below.
resource "azurerm_api_management_api" "example" {
name = "example-api"
…

hitman126
- 699
- 1
- 12
- 43
0
votes
1 answer
Android Studio: ContentValues vs Database.execSQL()
My question can be considered as a continuation of What is the difference between inserting data using ContentValues and Raw SQL in SQLite Android?
My question is more towards: Which is more common for programmers? Or is it a question of what kind…

Just Learning
- 15
- 5
0
votes
0 answers
Trying to copy image one folder to another folder using contentResolver in android 11 but it create blank image
i m working on an application where i have list of images inside recyclerview and from recyclerview i have to copy my images from one folder to another folder my code is working fine in many android 11 and 12 device but in few device it creates…

patel jignesh
- 1
- 1
0
votes
0 answers
Share video to WhatsApp and other apps using Android Intent (Java)
I want to implement share video to whatsApp and other app feature using Android Intent system.
I have been looking for it for last 2 days but I did not get proper solution and some solutions I found on StackOverFlow, they no longer work I…

Abhay
- 101
- 2
- 7