Issue
I speak a little english, sorry if its hard to read.
This is my problem. I did a class extending Asyntask to set values to 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 paremeter is a array contentvalues, and I don't know how to take values/key back. If it was a contentvalues, I would take the values back with iterator, and map. But I don't know how to transform it in a contentvalues first. :-(
I was thinking about to pass another kind of parameter like String and then get it with a loop and put it in a ContentValues.
Solution
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];
Answered By - eltabo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.