I speak a little english, sorry if its hard to read.
This is my problem: I made a class extending Asynctask
to set values in a database.
But the paremeter I set in generic types was ContentValues
.
class putInformationToDB extends AsyncTask<ContentValues, Integer, Integer>
Then when I call the execute method to run it, I set a ContentValues
that I made previously to get all the values from registry and dialogs.
But now in the method:
protected Integer doInBackground(ContentValues... params)
I have a problem. The parameter is an array of ContentValues
, and I don't know how to get the values/key back. If it was a ContentValues
, I would get the values back with Iterator
and map
. But I don't know how to transform it into a ContentValues
first. :-(
I was thinking about passing in another kind of parameter like String and then get it with a loop and put it in a ContentValues.
You can simply iterate over the array:
for(ContentValues c : params){
//do something with c
}
or if you're sure that there is only an element in the array you can access it directly:
ContentValues c = params[0];